blob: 0818edc41bb36455d5ff11b1a7b8c18c9837b4ab [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)
gpotter2291400c2017-04-25 20:28:46 +020036 os.chmod(fname, 0o755)
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',
Ajax94059a12017-10-27 19:17:41 +020061 'scapy/modules/krack',
plorinquer3ee32c22016-07-27 13:27:51 +020062 'scapy/asn1',
63 'scapy/tools',
64 ],
65 scripts=SCRIPTS,
66 data_files=[('share/man/man1', ["doc/scapy.1.gz"])],
Robin Jarry4f710272016-08-19 11:58:42 +020067 package_data={
68 'scapy': ['VERSION'],
69 },
Phild4d86e92008-08-10 18:46:34 +020070
Phil1123fed2008-07-29 15:18:17 +020071 # Metadata
plorinquer3ee32c22016-07-27 13:27:51 +020072 author='Philippe BIONDI',
73 author_email='phil(at)secdev.org',
Pierre LALET5e489812017-10-03 13:32:10 +020074 maintainer='Pierre LALET, Guillaume VALADON',
plorinquer3ee32c22016-07-27 13:27:51 +020075 description='Scapy: interactive packet manipulation tool',
76 license='GPLv2',
77 url='http://www.secdev.org/projects/scapy',
Pierre LALET1b1b6872016-01-21 19:40:52 +010078 download_url='https://github.com/secdev/scapy/tarball/master',
79 keywords=["network"],
80 classifiers=[
81 "Development Status :: 5 - Production/Stable",
82 "Environment :: Console",
83 "Intended Audience :: Developers",
84 "Intended Audience :: Information Technology",
85 "Intended Audience :: Science/Research",
86 "Intended Audience :: System Administrators",
87 "Intended Audience :: Telecommunications Industry",
88 "License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
89 "Programming Language :: Python :: 2",
Pierre LALET1b1b6872016-01-21 19:40:52 +010090 "Programming Language :: Python :: 2.7",
Pierre LALET5e489812017-10-03 13:32:10 +020091 "Programming Language :: Python :: 3",
92 "Programming Language :: Python :: 3.3",
93 "Programming Language :: Python :: 3.4",
94 "Programming Language :: Python :: 3.5",
95 "Programming Language :: Python :: 3.6",
Pierre LALET1b1b6872016-01-21 19:40:52 +010096 "Topic :: Security",
97 "Topic :: System :: Networking",
98 "Topic :: System :: Networking :: Monitoring",
99 ]
Phil1123fed2008-07-29 15:18:17 +0200100)