Skip to content

Commit 669506b

Browse files
gpotter2KOLANICH
andauthored
Migrate to pyproject.toml (secdev#3869)
* Migrate to `pyproject.toml` Co-authored-by: KOLANICH <kolan_n@mail.ru> * Bump setuptools to 62.0.0 Otherwise we suffer from the bug described in pypa/setuptools, secdev#3244 * Codecov: xml upload --------- Co-authored-by: KOLANICH <kolan_n@mail.ru>
1 parent 6eaffb3 commit 669506b

File tree

7 files changed

+121
-105
lines changed

7 files changed

+121
-105
lines changed

.github/workflows/unittests.yml

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -125,9 +125,7 @@ jobs:
125125
- name: Run Tox
126126
run: UT_FLAGS="${{ matrix.flags }}" ./.config/ci/test.sh ${{ matrix.python }} ${{ matrix.mode }}
127127
- name: Codecov
128-
uses: codecov/codecov-action@v2
129-
with:
130-
file: /home/runner/work/scapy/scapy/.coverage
128+
uses: codecov/codecov-action@v3
131129

132130
cryptography:
133131
name: pyca/cryptography test

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ MANIFEST
66
*.egg-info/
77
test/*.html
88
.coverage*
9+
coverage.xml
910
.tox
1011
.ipynb_checkpoints
1112
.mypy_cache

README.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,8 +65,7 @@ Other useful resources:
6565

6666
- [Scapy in 20 minutes](https://github.com/secdev/scapy/blob/master/doc/notebooks/Scapy%20in%2015%20minutes.ipynb)
6767
- [Interactive tutorial](https://scapy.readthedocs.io/en/latest/usage.html#interactive-tutorial) (part of the documentation)
68-
- [The quick demo: an interactive session](https://scapy.readthedocs.io/en/latest/introduction.html#quick-demo)
69-
(some examples may be outdated)
68+
- [The quick demo: an interactive session](https://scapy.readthedocs.io/en/latest/introduction.html#quick-demo) (some examples may be outdated)
7069
- [HTTP/2 notebook](https://github.com/secdev/scapy/blob/master/doc/notebooks/HTTP_2_Tuto.ipynb)
7170
- [TLS notebooks](https://github.com/secdev/scapy/blob/master/doc/notebooks/tls)
7271

pyproject.toml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
[build-system]
2+
requires = [ "setuptools>=62.0.0" ]
3+
build-backend = "setuptools.build_meta"
4+
5+
[project]
6+
name = "scapy"
7+
dynamic = [ "version", "readme" ]
8+
authors = [
9+
{ name="Philippe BIONDI" },
10+
]
11+
maintainers = [
12+
{ name="Pierre LALET" },
13+
{ name="Gabriel POTTER" },
14+
{ name="Guillaume VALADON" },
15+
]
16+
license = { text="GPL-2.0-only" }
17+
requires-python = ">=3.7, <4"
18+
description = "Scapy: interactive packet manipulation tool"
19+
keywords = [ "network" ]
20+
classifiers = [
21+
"Development Status :: 5 - Production/Stable",
22+
"Environment :: Console",
23+
"Intended Audience :: Developers",
24+
"Intended Audience :: Information Technology",
25+
"Intended Audience :: Science/Research",
26+
"Intended Audience :: System Administrators",
27+
"Intended Audience :: Telecommunications Industry",
28+
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
29+
"Programming Language :: Python :: 3",
30+
"Programming Language :: Python :: 3 :: Only",
31+
"Programming Language :: Python :: 3.7",
32+
"Programming Language :: Python :: 3.8",
33+
"Programming Language :: Python :: 3.9",
34+
"Programming Language :: Python :: 3.10",
35+
"Topic :: Security",
36+
"Topic :: System :: Networking",
37+
"Topic :: System :: Networking :: Monitoring",
38+
]
39+
40+
[project.urls]
41+
homepage = "https://scapy.net"
42+
documentation = "https://scapy.readthedocs.io"
43+
repository = "https://github.com/secdev/scapy"
44+
changelog = "https://github.com/secdev/scapy/releases"
45+
46+
[project.scripts]
47+
scapy = "scapy.main:interact"
48+
49+
[project.optional-dependencies]
50+
basic = [ "ipython" ]
51+
complete = [
52+
"ipython",
53+
"pyx",
54+
"cryptography>=2.0",
55+
"matplotlib",
56+
]
57+
docs = [
58+
"sphinx>=3.0.0",
59+
"sphinx_rtd_theme>=0.4.3",
60+
"tox>=3.0.0",
61+
]
62+
63+
# setuptools specific
64+
65+
[tool.setuptools]
66+
zip-safe = false # We use __file__ in scapy/__init__.py, therefore Scapy isn't zip safe
67+
68+
[tool.setuptools.packages.find]
69+
include = [
70+
"scapy*",
71+
]
72+
exclude = [
73+
"test*",
74+
"doc*",
75+
]
76+
77+
[tool.setuptools.dynamic]
78+
version = { attr="scapy.VERSION" }
79+
80+
# coverage
81+
82+
[tool.coverage]
83+
concurrency = "multiprocessing"
84+
omit = [
85+
# Scapy specific paths
86+
"scapy/tools/UTscapy.py",
87+
"test/*",
88+
# Scapy external modules
89+
"scapy/libs/six.py",
90+
"scapy/libs/winpcapy.py",
91+
"scapy/libs/ethertypes.py",
92+
# .tox specific path
93+
".tox/*",
94+
# OS specific paths
95+
"/private/*",
96+
]

setup.cfg

Lines changed: 0 additions & 26 deletions
This file was deleted.

setup.py

Lines changed: 17 additions & 70 deletions
Original file line numberDiff line numberDiff line change
@@ -1,20 +1,27 @@
11
#! /usr/bin/env python
22

33
"""
4-
Distutils setup file for Scapy.
4+
Setuptools setup file for Scapy.
55
"""
66

7+
import io
8+
import os
9+
import sys
10+
11+
if sys.version_info[0] <= 2:
12+
raise OSError("Scapy no longer supports Python 2 ! Please use Scapy 2.5.0")
13+
714
try:
8-
from setuptools import setup, find_packages
15+
from setuptools import setup
916
from setuptools.command.sdist import sdist
1017
except:
1118
raise ImportError("setuptools is required to install scapy !")
12-
import io
13-
import os
1419

1520

1621
def get_long_description():
17-
"""Extract description from README.md, for PyPI's usage"""
22+
"""
23+
Extract description from README.md, for PyPI's usage
24+
"""
1825
def process_ignore_tags(buffer):
1926
return "\n".join(
2027
x for x in buffer.split("\n") if "<!-- ignore_ppi -->" not in x
@@ -31,78 +38,18 @@ def process_ignore_tags(buffer):
3138

3239

3340
class SDist(sdist):
34-
35-
def make_release_tree(self, base_dir, files):
36-
sdist.make_release_tree(self, base_dir, files)
41+
"""
42+
Modified sdist to create scapy/VERSION file
43+
"""
44+
def make_release_tree(self, base_dir, *args, **kwargs):
45+
super(SDist, self).make_release_tree(base_dir, *args, **kwargs)
3746
# ensure there's a scapy/VERSION file
3847
fn = os.path.join(base_dir, 'scapy', 'VERSION')
3948
with open(fn, 'w') as f:
4049
f.write(__import__('scapy').VERSION)
4150

42-
43-
# https://packaging.python.org/guides/distributing-packages-using-setuptools/
4451
setup(
45-
name='scapy',
46-
version=__import__('scapy').VERSION,
47-
packages=find_packages(exclude=["test"]),
48-
data_files=[('share/man/man1', ["doc/scapy.1"])],
4952
cmdclass={'sdist': SDist},
50-
# Build starting scripts automatically
51-
entry_points={
52-
'console_scripts': [
53-
'scapy = scapy.main:interact'
54-
]
55-
},
56-
python_requires='>=3.7, <4',
57-
# pip > 9 handles all the versioning
58-
extras_require={
59-
'basic': ["ipython"],
60-
'complete': [
61-
'ipython',
62-
'pyx',
63-
'cryptography>=2.0',
64-
'matplotlib'
65-
],
66-
'docs': [
67-
'sphinx>=3.0.0',
68-
'sphinx_rtd_theme>=0.4.3',
69-
'tox>=3.0.0'
70-
]
71-
},
72-
# We use __file__ in scapy/__init__.py, therefore Scapy isn't zip safe
73-
zip_safe=False,
74-
75-
# Metadata
76-
author='Philippe BIONDI',
77-
author_email='phil(at)secdev.org',
78-
maintainer='Pierre LALET, Gabriel POTTER, Guillaume VALADON',
79-
description='Scapy: interactive packet manipulation tool',
8053
long_description=get_long_description(),
8154
long_description_content_type='text/markdown',
82-
license='GPL-2.0-only',
83-
url='https://scapy.net',
84-
project_urls={
85-
'Documentation': 'https://scapy.readthedocs.io',
86-
'Source Code': 'https://github.com/secdev/scapy/',
87-
},
88-
download_url='https://github.com/secdev/scapy/tarball/master',
89-
keywords=["network"],
90-
classifiers=[
91-
"Development Status :: 5 - Production/Stable",
92-
"Environment :: Console",
93-
"Intended Audience :: Developers",
94-
"Intended Audience :: Information Technology",
95-
"Intended Audience :: Science/Research",
96-
"Intended Audience :: System Administrators",
97-
"Intended Audience :: Telecommunications Industry",
98-
"License :: OSI Approved :: GNU General Public License v2 (GPLv2)",
99-
"Programming Language :: Python :: 3",
100-
"Programming Language :: Python :: 3.7",
101-
"Programming Language :: Python :: 3.8",
102-
"Programming Language :: Python :: 3.9",
103-
"Programming Language :: Python :: 3.10",
104-
"Topic :: Security",
105-
"Topic :: System :: Networking",
106-
"Topic :: System :: Networking :: Monitoring",
107-
]
10855
)

tox.ini

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
envlist = py{27,34,35,36,37,38,39,310,py27,py39}-{linux,bsd}_{non_root,root},
77
py{27,34,35,36,37,38,39,310,py27,py39}-windows,
88
skip_missing_interpreters = true
9-
minversion = 2.9
9+
minversion = 4.0
1010

1111
# Main tests
1212

1313
[testenv]
1414
description = "Scapy unit tests"
1515
allowlist_externals = sudo
1616
parallel_show_output = true
17+
package = wheel
1718
passenv =
1819
PATH
1920
PWD
@@ -28,7 +29,7 @@ deps = mock
2829
setuptools>=18.5
2930
ipython
3031
cryptography
31-
coverage
32+
coverage[toml]
3233
python-can
3334
# disabled on windows because they require c++ dependencies
3435
brotli ; sys_platform != 'win32'
@@ -43,7 +44,7 @@ commands =
4344
bsd_non_root: {envpython} {env:SCAPY_PY_OPTS:-m coverage run} -m scapy.tools.UTscapy -c test/configs/bsd.utsc -K manufdb -K tshark -N {posargs}
4445
bsd_root: sudo -E {envpython} {env:SCAPY_PY_OPTS:-m coverage run} -m scapy.tools.UTscapy -c test/configs/bsd.utsc -K manufdb -K tshark {posargs}
4546
windows: {envpython} {env:SCAPY_PY_OPTS:-m coverage run} -m scapy.tools.UTscapy -c test/configs/windows.utsc {posargs}
46-
coverage combine
47+
coverage xml -i
4748

4849
# Variants of the main tests
4950

@@ -71,7 +72,7 @@ commands =
7172
bash -c "rm -rf /tmp/can-utils /tmp/can-isotp"
7273
lsmod
7374
sudo -E {envpython} -m coverage run -m scapy.tools.UTscapy -c ./test/configs/linux.utsc {posargs}
74-
coverage combine
75+
coverage xml -i
7576

7677
# Test used by upstream pyca/cryptography
7778
[testenv:cryptography]

0 commit comments

Comments
 (0)
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy