blob: 8372967a6154266ed765755a99844f7fa0b960c8 [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
plorinquer3ee32c22016-07-27 13:27:51 +020015EZIP_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
plorinquer3ee32c22016-07-27 13:27:51 +020019
Philb7d3d932014-12-18 16:22:04 +010020def make_ezipfile(base_name, base_dir, verbose=0, dry_run=0, **kwargs):
Phil1123fed2008-07-29 15:18:17 +020021 fname = archive_util.make_zipfile(base_name, base_dir, verbose, dry_run)
plorinquer3ee32c22016-07-27 13:27:51 +020022 ofname = fname + ".old"
23 os.rename(fname, ofname)
24 of = open(ofname)
25 f = open(fname, "w")
Phil1123fed2008-07-29 15:18:17 +020026 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()
Phile31a8512010-08-06 11:53:22 +020033 os.system("zip -A '%s'" % fname)
Phil1123fed2008-07-29 15:18:17 +020034 of.close()
35 os.unlink(ofname)
plorinquer3ee32c22016-07-27 13:27:51 +020036 os.chmod(fname, 0755)
Phil1123fed2008-07-29 15:18:17 +020037 return fname
38
39
plorinquer3ee32c22016-07-27 13:27:51 +020040archive_util.ARCHIVE_FORMATS["ezip"] = (
41 make_ezipfile, [], 'Executable ZIP file')
Phil1123fed2008-07-29 15:18:17 +020042
plorinquer3ee32c22016-07-27 13:27:51 +020043SCRIPTS = ['bin/scapy', 'bin/UTscapy']
44# On Windows we also need additional batch files to run the above scripts
Dirk Loss29146dd2009-10-18 14:36:33 +020045if os.name == "nt":
plorinquer3ee32c22016-07-27 13:27:51 +020046 SCRIPTS += ['bin/scapy.bat', 'bin/UTscapy.bat']
Phil1123fed2008-07-29 15:18:17 +020047
48setup(
plorinquer3ee32c22016-07-27 13:27:51 +020049 name='scapy',
Robin Jarry4f710272016-08-19 11:58:42 +020050 version=__import__('scapy').VERSION,
plorinquer3ee32c22016-07-27 13:27:51 +020051 packages=[
52 'scapy',
53 'scapy/arch',
Pierre LALET0e1b9202016-12-03 17:25:59 +010054 'scapy/arch/bpf',
plorinquer3ee32c22016-07-27 13:27:51 +020055 'scapy/arch/windows',
56 'scapy/contrib',
57 'scapy/layers',
58 'scapy/layers/tls',
59 'scapy/layers/tls/crypto',
60 'scapy/modules',
61 'scapy/asn1',
62 'scapy/tools',
63 ],
64 scripts=SCRIPTS,
65 data_files=[('share/man/man1', ["doc/scapy.1.gz"])],
Robin Jarry4f710272016-08-19 11:58:42 +020066 package_data={
67 'scapy': ['VERSION'],
68 },
Phild4d86e92008-08-10 18:46:34 +020069
Phil1123fed2008-07-29 15:18:17 +020070 # Metadata
plorinquer3ee32c22016-07-27 13:27:51 +020071 author='Philippe BIONDI',
72 author_email='phil(at)secdev.org',
73 description='Scapy: interactive packet manipulation tool',
74 license='GPLv2',
75 url='http://www.secdev.org/projects/scapy',
Pierre LALET1b1b6872016-01-21 19:40:52 +010076 download_url='https://github.com/secdev/scapy/tarball/master',
77 keywords=["network"],
78 classifiers=[
79 "Development Status :: 5 - Production/Stable",
80 "Environment :: Console",
81 "Intended Audience :: Developers",
82 "Intended Audience :: Information Technology",
83 "Intended Audience :: Science/Research",
84 "Intended Audience :: System Administrators",
85 "Intended Audience :: Telecommunications Industry",
86 "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
87 "Programming Language :: Python :: 2",
Pierre LALET1b1b6872016-01-21 19:40:52 +010088 "Programming Language :: Python :: 2.7",
89 "Topic :: Security",
90 "Topic :: System :: Networking",
91 "Topic :: System :: Networking :: Monitoring",
92 ]
Phil1123fed2008-07-29 15:18:17 +020093)