44Distutils setup file for Scapy. 
55""" 
66
7- 
8- from  distutils  import  archive_util 
97try :
10-     from  setuptools  import  setup 
11- except   ImportError :
12-     from   distutils . core   import   setup 
8+     from  setuptools  import  setup ,  find_packages 
9+ except :
10+     raise   ImportError ( "setuptools is required to install scapy !" ) 
1311import  io 
1412import  os 
1513
1614
17- EZIP_HEADER  =  """#! /bin/sh 
18- PYTHONPATH=$0/%s exec python -m scapy 
19- """ 
20- 
21- 
22- def  make_ezipfile (base_name , base_dir , verbose = 0 , dry_run = 0 , ** kwargs ):
23-     fname  =  archive_util .make_zipfile (base_name , base_dir , verbose , dry_run )
24-     ofname  =  fname  +  ".old" 
25-     os .rename (fname , ofname )
26-     of  =  open (ofname )
27-     f  =  open (fname , "w" )
28-     f .write (EZIP_HEADER  %  base_dir )
29-     while  True :
30-         data  =  of .read (8192 )
31-         if  not  data :
32-             break 
33-         f .write (data )
34-     f .close ()
35-     os .system ("zip -A '%s'"  %  fname )
36-     of .close ()
37-     os .unlink (ofname )
38-     os .chmod (fname , 0o755 )
39-     return  fname 
40- 
41- 
42- archive_util .ARCHIVE_FORMATS ["ezip" ] =  (
43-     make_ezipfile , [], 'Executable ZIP file' )
44- 
45- 
4615def  get_long_description ():
16+     """Extract description from README.md, for PyPI's usage""" 
4717    try :
48-         with  io .open (os .path .join (os .path .dirname (__file__ ), "README.md" ), encoding = "utf-8" ) as  f :
18+         fpath  =  os .path .join (os .path .dirname (__file__ ), "README.md" )
19+         with  io .open (fpath , encoding = "utf-8" ) as  f :
4920            readme  =  f .read ()
5021            desc  =  readme .partition ("<!-- start_ppi_description -->" )[2 ]
5122            desc  =  desc .partition ("<!-- stop_ppi_description -->" )[0 ]
@@ -54,41 +25,34 @@ def get_long_description():
5425        return  None 
5526
5627
57- SCRIPTS  =  ['bin/scapy' , 'bin/UTscapy' ]
58- # On Windows we also need additional batch files to run the above scripts 
59- if  os .name  ==  "nt" :
60-     SCRIPTS  +=  ['bin/scapy.bat' , 'bin/UTscapy.bat' ]
61- 
28+ # https://packaging.python.org/guides/distributing-packages-using-setuptools/ 
6229setup (
6330    name = 'scapy' ,
6431    version = __import__ ('scapy' ).VERSION ,
65-     packages = [
66-         'scapy' ,
67-         'scapy/arch' ,
68-         'scapy/arch/bpf' ,
69-         'scapy/arch/windows' ,
70-         'scapy/contrib' ,
71-         'scapy/contrib/automotive' ,
72-         'scapy/contrib/automotive/bmw' ,
73-         'scapy/contrib/automotive/gm' ,
74-         'scapy/contrib/automotive/obd' ,
75-         'scapy/contrib/automotive/obd/pid' ,
76-         'scapy/contrib/automotive/obd/iid' ,
77-         'scapy/contrib/automotive/obd/tid' ,
78-         'scapy/contrib/automotive/obd/mid' ,
79-         'scapy/layers' ,
80-         'scapy/layers/tls' ,
81-         'scapy/layers/tls/crypto' ,
82-         'scapy/modules' ,
83-         'scapy/modules/krack' ,
84-         'scapy/asn1' ,
85-         'scapy/tools' ,
86-     ],
87-     scripts = SCRIPTS ,
32+     packages = find_packages (),
8833    data_files = [('share/man/man1' , ["doc/scapy.1" ])],
8934    package_data = {
9035        'scapy' : ['VERSION' ],
9136    },
37+     # Build starting scripts automatically 
38+     entry_points = {
39+         'console_scripts' : [
40+             'scapy = scapy.main:interact' ,
41+             'UTscapy = scapy.tools.UTscapy:main' 
42+         ]
43+     },
44+     python_requires = '>=2.7, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*, <4' ,
45+     extras_require = {
46+         'basic' : ["ipython" ],
47+         'complete' : [
48+             'ipython>=7;  python_version>="3"' ,
49+             'ipython<6;  python_version<"3"' ,
50+             'pyx>=0.14; python_version>="3"' ,
51+             'pyx==0.12.1; python_version<"3"' ,
52+             'cryptography' ,
53+             'matplotlib' 
54+         ]
55+     },
9256
9357    # Metadata 
9458    author = 'Philippe BIONDI' ,
0 commit comments