blob: 5465b4b498191e341395723c34972391ddcfcb71 [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
15EZIP_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
Philb7d3d932014-12-18 16:22:04 +010019def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs):
Phil1123fed2008-07-29 15:18:17 +020020 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()
Phile31a8512010-08-06 11:53:22 +020032 os.system("zip -A '%s'" % fname)
Phil1123fed2008-07-29 15:18:17 +020033 of.close()
34 os.unlink(ofname)
35 os.chmod(fname,0755)
36 return fname
37
38
39
40archive_util.ARCHIVE_FORMATS["ezip"] = (make_ezipfile,[],'Executable ZIP file')
41
Dirk Loss29146dd2009-10-18 14:36:33 +020042SCRIPTS = ['bin/scapy','bin/UTscapy']
43# On Windows we also need additional batch files to run the above scripts
44if os.name == "nt":
45 SCRIPTS += ['bin/scapy.bat','bin/UTscapy.bat']
Phil1123fed2008-07-29 15:18:17 +020046
47setup(
Phila6b49922008-08-11 17:42:53 +020048 name = 'scapy',
Guillaume Valadon9811db32014-12-17 13:15:23 +010049 version = '2.3.0-dev',
Phil6bfb92a2011-04-02 00:01:10 +020050 packages=['scapy','scapy/arch', 'scapy/arch/windows', 'scapy/layers','scapy/asn1','scapy/tools','scapy/modules', 'scapy/crypto', 'scapy/contrib'],
Dirk Loss29146dd2009-10-18 14:36:33 +020051 scripts = SCRIPTS,
Phild4d86e92008-08-10 18:46:34 +020052 data_files = [('share/man/man1', ["doc/scapy.1.gz"])],
53
Phil1123fed2008-07-29 15:18:17 +020054 # 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)