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 | |
| 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 | |
Phil | b7d3d93 | 2014-12-18 16:22:04 +0100 | [diff] [blame^] | 19 | def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs): |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 20 | fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run) |
| 21 | ofname = fname+".old" |
| 22 | os.rename(fname,ofname) |
| 23 | of=open(ofname) |
| 24 | f=open(fname,"w") |
| 25 | f.write(EZIP_HEADER % base_dir) |
| 26 | while True: |
| 27 | data = of.read(8192) |
| 28 | if not data: |
| 29 | break |
| 30 | f.write(data) |
| 31 | f.close() |
Phil | e31a851 | 2010-08-06 11:53:22 +0200 | [diff] [blame] | 32 | os.system("zip -A '%s'" % fname) |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 33 | of.close() |
| 34 | os.unlink(ofname) |
| 35 | os.chmod(fname,0755) |
| 36 | return fname |
| 37 | |
| 38 | |
| 39 | |
| 40 | archive_util.ARCHIVE_FORMATS["ezip"] = (make_ezipfile,[],'Executable ZIP file') |
| 41 | |
Dirk Loss | 29146dd | 2009-10-18 14:36:33 +0200 | [diff] [blame] | 42 | SCRIPTS = ['bin/scapy','bin/UTscapy'] |
| 43 | # On Windows we also need additional batch files to run the above scripts |
| 44 | if os.name == "nt": |
| 45 | SCRIPTS += ['bin/scapy.bat','bin/UTscapy.bat'] |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 46 | |
| 47 | setup( |
Phil | a6b4992 | 2008-08-11 17:42:53 +0200 | [diff] [blame] | 48 | name = 'scapy', |
Guillaume Valadon | 9811db3 | 2014-12-17 13:15:23 +0100 | [diff] [blame] | 49 | version = '2.3.0-dev', |
Phil | 6bfb92a | 2011-04-02 00:01:10 +0200 | [diff] [blame] | 50 | packages=['scapy','scapy/arch', 'scapy/arch/windows', 'scapy/layers','scapy/asn1','scapy/tools','scapy/modules', 'scapy/crypto', 'scapy/contrib'], |
Dirk Loss | 29146dd | 2009-10-18 14:36:33 +0200 | [diff] [blame] | 51 | scripts = SCRIPTS, |
Phil | d4d86e9 | 2008-08-10 18:46:34 +0200 | [diff] [blame] | 52 | data_files = [('share/man/man1', ["doc/scapy.1.gz"])], |
| 53 | |
Phil | 1123fed | 2008-07-29 15:18:17 +0200 | [diff] [blame] | 54 | # Metadata |
| 55 | author = 'Philippe BIONDI', |
| 56 | author_email = 'phil(at)secdev.org', |
| 57 | description = 'Scapy: interactive packet manipulation tool', |
| 58 | license = 'GPLv2', |
| 59 | url = 'http://www.secdev.org/projects/scapy' |
| 60 | # keywords = '', |
| 61 | # url = '', |
| 62 | ) |