Skip to content
Snippets Groups Projects
setup.py 2.84 KiB
Newer Older
Phil's avatar
Phil committed
#! /usr/bin/env python

"""
Distutils setup file for Scapy.
"""

Phil's avatar
Phil committed

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
PYTHONPATH=$0/%s exec python -m scapy.__init__
Phil's avatar
Phil committed
"""

def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs):
Phil's avatar
Phil committed
    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")
Phil's avatar
Phil committed
    f.write(EZIP_HEADER % base_dir)
    while True:
        data = of.read(8192)
        if not data:
            break
        f.write(data)
    f.close()
    os.system("zip -A '%s'" % fname)
Phil's avatar
Phil committed
    of.close()
    os.unlink(ofname)
gpotter2's avatar
gpotter2 committed
    os.chmod(fname, 0o755)
Phil's avatar
Phil committed
    return fname


archive_util.ARCHIVE_FORMATS["ezip"] = (
    make_ezipfile, [], 'Executable ZIP file')
Phil's avatar
Phil committed

SCRIPTS = ['bin/scapy', 'bin/UTscapy']
# On Windows we also need additional batch files to run the above scripts
    SCRIPTS += ['bin/scapy.bat', 'bin/UTscapy.bat']
Phil's avatar
Phil committed

setup(
Robin Jarry's avatar
Robin Jarry committed
    version=__import__('scapy').VERSION,
    packages=[
        'scapy',
        'scapy/arch',
        'scapy/arch/bpf',
        'scapy/arch/windows',
        'scapy/contrib',
        'scapy/layers',
        'scapy/layers/tls',
        'scapy/layers/tls/crypto',
        'scapy/modules',
        'scapy/asn1',
        'scapy/tools',
    ],
    scripts=SCRIPTS,
    data_files=[('share/man/man1', ["doc/scapy.1.gz"])],
Robin Jarry's avatar
Robin Jarry committed
    package_data={
        'scapy': ['VERSION'],
    },
Phil's avatar
Phil committed

Phil's avatar
Phil committed
    # Metadata
    author='Philippe BIONDI',
    author_email='phil(at)secdev.org',
    maintainer='Pierre LALET, Guillaume VALADON',
    description='Scapy: interactive packet manipulation tool',
    license='GPLv2',
    url='http://www.secdev.org/projects/scapy',
    download_url='https://github.com/secdev/scapy/tarball/master',
    keywords=["network"],
    classifiers=[
        "Development Status :: 5 - Production/Stable",
        "Environment :: Console",
        "Intended Audience :: Developers",
        "Intended Audience :: Information Technology",
        "Intended Audience :: Science/Research",
        "Intended Audience :: System Administrators",
        "Intended Audience :: Telecommunications Industry",
        "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
        "Programming Language :: Python :: 2",
        "Programming Language :: Python :: 2.7",
        "Programming Language :: Python :: 3",
        "Programming Language :: Python :: 3.3",
        "Programming Language :: Python :: 3.4",
        "Programming Language :: Python :: 3.5",
        "Programming Language :: Python :: 3.6",
        "Topic :: Security",
        "Topic :: System :: Networking",
        "Topic :: System :: Networking :: Monitoring",
    ]
Phil's avatar
Phil committed
)