2008-07-29 13:18:17 +00:00
|
|
|
#! /usr/bin/env python
|
|
|
|
|
2010-06-16 20:47:55 +00:00
|
|
|
"""
|
|
|
|
Distutils setup file for Scapy.
|
|
|
|
"""
|
|
|
|
|
2008-07-29 13:18:17 +00:00
|
|
|
|
|
|
|
from distutils import archive_util
|
|
|
|
from distutils import sysconfig
|
|
|
|
from distutils.core import setup
|
|
|
|
from distutils.command.sdist import sdist
|
|
|
|
import os
|
|
|
|
|
|
|
|
|
|
|
|
EZIP_HEADER="""#! /bin/sh
|
2009-04-13 23:16:00 +00:00
|
|
|
PYTHONPATH=$0/%s exec python -m scapy.__init__
|
2008-07-29 13:18:17 +00:00
|
|
|
"""
|
|
|
|
|
|
|
|
def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0):
|
|
|
|
fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run)
|
|
|
|
ofname = fname+".old"
|
|
|
|
os.rename(fname,ofname)
|
|
|
|
of=open(ofname)
|
|
|
|
f=open(fname,"w")
|
|
|
|
f.write(EZIP_HEADER % base_dir)
|
|
|
|
while True:
|
|
|
|
data = of.read(8192)
|
|
|
|
if not data:
|
|
|
|
break
|
|
|
|
f.write(data)
|
|
|
|
f.close()
|
2010-08-06 09:53:22 +00:00
|
|
|
os.system("zip -A '%s'" % fname)
|
2008-07-29 13:18:17 +00:00
|
|
|
of.close()
|
|
|
|
os.unlink(ofname)
|
|
|
|
os.chmod(fname,0755)
|
|
|
|
return fname
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
archive_util.ARCHIVE_FORMATS["ezip"] = (make_ezipfile,[],'Executable ZIP file')
|
|
|
|
|
2009-10-18 12:36:33 +00:00
|
|
|
SCRIPTS = ['bin/scapy','bin/UTscapy']
|
|
|
|
# On Windows we also need additional batch files to run the above scripts
|
|
|
|
if os.name == "nt":
|
|
|
|
SCRIPTS += ['bin/scapy.bat','bin/UTscapy.bat']
|
2008-07-29 13:18:17 +00:00
|
|
|
|
|
|
|
setup(
|
2008-08-11 15:42:53 +00:00
|
|
|
name = 'scapy',
|
2011-02-28 02:02:47 +00:00
|
|
|
version = '2.2.0-dev',
|
2009-11-05 10:55:10 +00:00
|
|
|
packages=['scapy','scapy/arch', 'scapy/arch/windows', 'scapy/layers','scapy/asn1','scapy/tools','scapy/modules', 'scapy/crypto'],
|
2009-10-18 12:36:33 +00:00
|
|
|
scripts = SCRIPTS,
|
2008-08-10 16:46:34 +00:00
|
|
|
data_files = [('share/man/man1', ["doc/scapy.1.gz"])],
|
|
|
|
|
2008-07-29 13:18:17 +00:00
|
|
|
# Metadata
|
|
|
|
author = 'Philippe BIONDI',
|
|
|
|
author_email = 'phil(at)secdev.org',
|
|
|
|
description = 'Scapy: interactive packet manipulation tool',
|
|
|
|
license = 'GPLv2',
|
|
|
|
url = 'http://www.secdev.org/projects/scapy'
|
|
|
|
# keywords = '',
|
|
|
|
# url = '',
|
|
|
|
)
|