Skip to content

Conversation

gpotter2
Copy link
Member

@gpotter2 gpotter2 commented Feb 24, 2019

I know that this PR sounds scary: droping distutils is something that we first had chosen not to do. However, since Python 3.7: https://docs.python.org/3/library/distutils.html it's "deprecated" in the way that

The recommended pip installer runs all setup.py scripts with setuptools, even if the script itself only imports distutils. Refer to the Python Packaging User Guide for more information.

Dropping distutils for setuptools allow us to perfom a big ammount of cleanup & stabilize our installation process. Note that currently, scapy.bat is broken on Windows. I've glanced at the IPython repo, where they have some compatibility patches to handle both distutils and setuptools (which would fix scapy.bat), but its lots of stuff to maintain.

This PR drops distutils, and:

  • refactor .bat files to follow the same architecture than on *nix: each _py*.bat file calls the main .bat file after setting %PYTHON%
  • remove PYTHONDONTWRITEBYTECODE call - we don't really need it and it make scapy's startup slower, when not installed
  • default to Python 3 when running ./run_scapy or run_scapy.bat
  • adds basic and complete scapy subversions, which contain the executables. I'll add them to the doc soon
  • automate script building: scapy.exe is now automatically generated (an equivalent is on linux), making it faster to load on Windows (as it avoids starting a cmd first)
  • removes the zip building capability (which is broken and unused). Scapy isn't zip-safe anymore, since we use VERSION file to store the git version, and those could be generated with setuptools anyways

@gpotter2 gpotter2 added the cleanup Performs some code clean-up label Feb 24, 2019
@gpotter2 gpotter2 changed the title Cleanup scapy executables Drop distutils - cleanup scapy executables Feb 25, 2019
@codecov
Copy link

codecov bot commented Feb 25, 2019

Codecov Report

Merging #1869 into master will increase coverage by 0.01%.
The diff coverage is n/a.

@@            Coverage Diff             @@
##           master    #1869      +/-   ##
==========================================
+ Coverage   85.76%   85.78%   +0.01%     
==========================================
  Files         185      185              
  Lines       42473    42473              
==========================================
+ Hits        36429    36436       +7     
+ Misses       6044     6037       -7
Impacted Files Coverage Δ
scapy/layers/inet6.py 88.23% <0%> (-0.06%) ⬇️
scapy/layers/ntp.py 92.04% <0%> (+0.53%) ⬆️
scapy/layers/tls/basefields.py 80.53% <0%> (+0.67%) ⬆️
scapy/layers/tls/handshake_sslv2.py 93.58% <0%> (+1.88%) ⬆️

@p-l-
Copy link
Member

p-l- commented Feb 26, 2019

Thanks again for your work @gpotter2. That's a great PR (and excellent arguments)!

@p-l- p-l- merged commit 3dab0c9 into secdev:master Feb 26, 2019
@gpotter2 gpotter2 deleted the tinyfix2 branch February 26, 2019 21:16
@gpotter2 gpotter2 mentioned this pull request Mar 5, 2019
27 tasks
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

cleanup Performs some code clean-up

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants