blob: f6771427ed9aad771d781ab5b07fd1a869e9f535 [file] [log] [blame]
Phil1123fed2008-07-29 15:18:17 +02001#! /usr/bin/env python
2
Dirk Loss0ce149b2010-06-16 22:47:55 +02003"""
4Distutils setup file for Scapy.
5"""
6
Phil1123fed2008-07-29 15:18:17 +02007
8from distutils import archive_util
9from distutils import sysconfig
10from distutils.core import setup
11from distutils.command.sdist import sdist
12import os
13
14
plorinquer3ee32c22016-07-27 13:27:51 +020015EZIP_HEADER = """#! /bin/sh
Phil71ad2b62009-04-14 01:16:00 +020016PYTHONPATH=$0/%s exec python -m scapy.__init__
Phil1123fed2008-07-29 15:18:17 +020017"""
18
plorinquer3ee32c22016-07-27 13:27:51 +020019
Philb7d3d932014-12-18 16:22:04 +010020def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs):
Phil1123fed2008-07-29 15:18:17 +020021 fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run)
plorinquer3ee32c22016-07-27 13:27:51 +020022 ofname = fname + ".old"
23 os.rename(fname, ofname)
24 of = open(ofname)
25 f = open(fname, "w")
Phil1123fed2008-07-29 15:18:17 +020026 f.write(EZIP_HEADER % base_dir)
27 while True:
28 data = of.read(8192)
29 if not data:
30 break
31 f.write(data)
32 f.close()
Phile31a8512010-08-06 11:53:22 +020033 os.system("zip -A '%s'" % fname)
Phil1123fed2008-07-29 15:18:17 +020034 of.close()
35 os.unlink(ofname)
plorinquer3ee32c22016-07-27 13:27:51 +020036 os.chmod(fname, 0755)
Phil1123fed2008-07-29 15:18:17 +020037 return fname
38
39
plorinquer3ee32c22016-07-27 13:27:51 +020040archive_util.ARCHIVE_FORMATS["ezip"] = (
41 make_ezipfile, [], 'Executable ZIP file')
Phil1123fed2008-07-29 15:18:17 +020042
plorinquer3ee32c22016-07-27 13:27:51 +020043SCRIPTS = ['bin/scapy', 'bin/UTscapy']
44# On Windows we also need additional batch files to run the above scripts
Dirk Loss29146dd2009-10-18 14:36:33 +020045if os.name == "nt":
plorinquer3ee32c22016-07-27 13:27:51 +020046 SCRIPTS += ['bin/scapy.bat', 'bin/UTscapy.bat']
Phil1123fed2008-07-29 15:18:17 +020047
48setup(
plorinquer3ee32c22016-07-27 13:27:51 +020049 name='scapy',
50 version='2.3.2-dev',
51 packages=[
52 'scapy',
53 'scapy/arch',
54 'scapy/arch/windows',
55 'scapy/contrib',
56 'scapy/layers',
57 'scapy/layers/tls',
58 'scapy/layers/tls/crypto',
59 'scapy/modules',
60 'scapy/asn1',
61 'scapy/tools',
62 ],
63 scripts=SCRIPTS,
64 data_files=[('share/man/man1', ["doc/scapy.1.gz"])],
Phild4d86e92008-08-10 18:46:34 +020065
Phil1123fed2008-07-29 15:18:17 +020066 # Metadata
plorinquer3ee32c22016-07-27 13:27:51 +020067 author='Philippe BIONDI',
68 author_email='phil(at)secdev.org',
69 description='Scapy: interactive packet manipulation tool',
70 license='GPLv2',
71 url='http://www.secdev.org/projects/scapy',
Pierre LALET1b1b6872016-01-21 19:40:52 +010072 download_url='https://github.com/secdev/scapy/tarball/master',
73 keywords=["network"],
74 classifiers=[
75 "Development Status :: 5 - Production/Stable",
76 "Environment :: Console",
77 "Intended Audience :: Developers",
78 "Intended Audience :: Information Technology",
79 "Intended Audience :: Science/Research",
80 "Intended Audience :: System Administrators",
81 "Intended Audience :: Telecommunications Industry",
82 "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
83 "Programming Language :: Python :: 2",
84 "Programming Language :: Python :: 2.5",
85 "Programming Language :: Python :: 2.6",
86 "Programming Language :: Python :: 2.7",
87 "Topic :: Security",
88 "Topic :: System :: Networking",
89 "Topic :: System :: Networking :: Monitoring",
90 ]
Phil1123fed2008-07-29 15:18:17 +020091)