Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 1 | #! /usr/bin/env python |
| 2 | |
Dirk Loss | 0ce149b | 2010-06-16 22:47:55 +0200 | [diff] [blame] | 3 | """ |
| 4 | Distutils setup file for Scapy. |
| 5 | """ |
| 6 | |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 7 | |
| 8 | from distutils import archive_util |
| 9 | from distutils import sysconfig |
| 10 | from distutils.core import setup |
| 11 | from distutils.command.sdist import sdist |
| 12 | import os |
| 13 | |
| 14 | |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 15 | EZIP_HEADER = """#! /bin/sh |
Phil | 71ad2b6 | 2009-04-14 01:16:00 +0200 | [diff] [blame] | 16 | PYTHONPATH=$0/%s exec python -m scapy.__init__ |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 17 | """ |
| 18 | |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 19 | |
Phil | b7d3d93 | 2014-12-18 16:22:04 +0100 | [diff] [blame] | 20 | def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs): |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 21 | fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run) |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 22 | ofname = fname + ".old" |
| 23 | os.rename(fname, ofname) |
| 24 | of = open(ofname) |
| 25 | f = open(fname, "w") |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 26 | 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() |
Phil | e31a851 | 2010-08-06 11:53:22 +0200 | [diff] [blame] | 33 | os.system("zip -A '%s'" % fname) |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 34 | of.close() |
| 35 | os.unlink(ofname) |
gpotter2 | 291400c | 2017-04-25 20:28:46 +0200 | [diff] [blame] | 36 | os.chmod(fname, 0o755) |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 37 | return fname |
| 38 | |
| 39 | |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 40 | archive_util.ARCHIVE_FORMATS["ezip"] = ( |
| 41 | make_ezipfile, [], 'Executable ZIP file') |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 42 | |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 43 | SCRIPTS = ['bin/scapy', 'bin/UTscapy'] |
| 44 | # On Windows we also need additional batch files to run the above scripts |
Dirk Loss | 29146dd | 2009-10-18 14:36:33 +0200 | [diff] [blame] | 45 | if os.name == "nt": |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 46 | SCRIPTS += ['bin/scapy.bat', 'bin/UTscapy.bat'] |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 47 | |
| 48 | setup( |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 49 | name='scapy', |
Robin Jarry | 4f71027 | 2016-08-19 11:58:42 +0200 | [diff] [blame] | 50 | version=__import__('scapy').VERSION, |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 51 | packages=[ |
| 52 | 'scapy', |
| 53 | 'scapy/arch', |
Pierre LALET | 0e1b920 | 2016-12-03 17:25:59 +0100 | [diff] [blame] | 54 | 'scapy/arch/bpf', |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 55 | 'scapy/arch/windows', |
| 56 | 'scapy/contrib', |
| 57 | 'scapy/layers', |
| 58 | 'scapy/layers/tls', |
| 59 | 'scapy/layers/tls/crypto', |
| 60 | 'scapy/modules', |
Ajax | 94059a1 | 2017-10-27 19:17:41 +0200 | [diff] [blame] | 61 | 'scapy/modules/krack', |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 62 | 'scapy/asn1', |
| 63 | 'scapy/tools', |
| 64 | ], |
| 65 | scripts=SCRIPTS, |
| 66 | data_files=[('share/man/man1', ["doc/scapy.1.gz"])], |
Robin Jarry | 4f71027 | 2016-08-19 11:58:42 +0200 | [diff] [blame] | 67 | package_data={ |
| 68 | 'scapy': ['VERSION'], |
| 69 | }, |
Phil | d4d86e9 | 2008-08-10 18:46:34 +0200 | [diff] [blame] | 70 | |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 71 | # Metadata |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 72 | author='Philippe BIONDI', |
| 73 | author_email='phil(at)secdev.org', |
Pierre LALET | 5e48981 | 2017-10-03 13:32:10 +0200 | [diff] [blame] | 74 | maintainer='Pierre LALET, Guillaume VALADON', |
plorinquer | 3ee32c2 | 2016-07-27 13:27:51 +0200 | [diff] [blame] | 75 | description='Scapy: interactive packet manipulation tool', |
| 76 | license='GPLv2', |
| 77 | url='http://www.secdev.org/projects/scapy', |
Pierre LALET | 1b1b687 | 2016-01-21 19:40:52 +0100 | [diff] [blame] | 78 | download_url='https://github.com/secdev/scapy/tarball/master', |
| 79 | keywords=["network"], |
| 80 | classifiers=[ |
| 81 | "Development Status :: 5 - Production/Stable", |
| 82 | "Environment :: Console", |
| 83 | "Intended Audience :: Developers", |
| 84 | "Intended Audience :: Information Technology", |
| 85 | "Intended Audience :: Science/Research", |
| 86 | "Intended Audience :: System Administrators", |
| 87 | "Intended Audience :: Telecommunications Industry", |
| 88 | "License :: OSI Approved :: GNU General Public License v2 (GPLv2)", |
| 89 | "Programming Language :: Python :: 2", |
Pierre LALET | 1b1b687 | 2016-01-21 19:40:52 +0100 | [diff] [blame] | 90 | "Programming Language :: Python :: 2.7", |
Pierre LALET | 5e48981 | 2017-10-03 13:32:10 +0200 | [diff] [blame] | 91 | "Programming Language :: Python :: 3", |
| 92 | "Programming Language :: Python :: 3.3", |
| 93 | "Programming Language :: Python :: 3.4", |
| 94 | "Programming Language :: Python :: 3.5", |
| 95 | "Programming Language :: Python :: 3.6", |
Pierre LALET | 1b1b687 | 2016-01-21 19:40:52 +0100 | [diff] [blame] | 96 | "Topic :: Security", |
| 97 | "Topic :: System :: Networking", |
| 98 | "Topic :: System :: Networking :: Monitoring", |
| 99 | ] |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 100 | ) |