You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* Build and check the wheel in the twine check as well
It should help to make sure that scapy can be installed from PyPI (or
any other package index) using pip and its sdist.
The check switched to the "build" build frontend because it builds
wheels from sdists by default:
https://pypa-build.readthedocs.io/en/stable/#python--m-build
* Remove README
In 669506b scapy switched to
pyproject.toml where 'readme' is dynamic and should be supplied by
setup.py. setup.py reads README.md and it works from inside the source
tree but since README.md isn't included in the sdist it fails when pip
or the build frontend builds the wheel from the sdist with:
```
distutils.errors.DistutilsOptionError: No configuration found for dynamic 'readme'.
Some dynamic fields need to be specified via `tool.setuptools.dynamic`
others must be specified via the equivalent attribute in `setup.py`.
```
This patch addresses that by removing README and letting setuptools
include README.md to the sdist automatcially.
README was added in 4f71027 in 2016 and back then it probably made
sense because setuptools didn't include README.md in the sdist
automatically. These days setuptools can handle README.md just fine so
it's no longer necessary to keep README any more.
It makes it possible to build the wheel from the sdist again.
Fixes:
```
python3 -m build
...
* Building wheel from sdist
* Creating venv isolated environment...
* Installing packages in isolated environment... (setuptools>=62.0.0)
* Getting build dependencies for wheel...
...
File "/tmp/build-env-vtaxy4xl/lib64/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 351, in _obtain_readme
self._ensure_previously_set(dist, "readme")
File "/tmp/build-env-vtaxy4xl/lib64/python3.11/site-packages/setuptools/config/pyprojecttoml.py", line 307, in _ensure_previously_set
raise OptionError(msg)
distutils.errors.DistutilsOptionError: No configuration found for dynamic 'readme'.
Some dynamic fields need to be specified via `tool.setuptools.dynamic`
others must be specified via the equivalent attribute in `setup.py`.
ERROR Backend subprocess exited when trying to invoke get_requires_for_build_wheel
```
and
```
python3 -m pip install dist/scapy-2.5.0.dev56.tar.gz
Processing ./dist/scapy-2.5.0.dev56.tar.gz
Installing build dependencies ... done
Getting requirements to build wheel ... error
error: subprocess-exited-with-error
× Getting requirements to build wheel did not run successfully.
│ exit code: 1
...
```
It's a follow-up to 669506b
* Update doc: installation & build instructions
* Make sure VERSION is also exported in wheels
* Cleanup MANIFEST.in
* Add packaging instructions
* Add git archive unit test
* Use %(describe:tags=True)
* Update doc/scapy/installation.rst
Co-authored-by: Evgeny Vereshchagin <[email protected]>
---------
Co-authored-by: Evgeny Vereshchagin <[email protected]>
Copy file name to clipboardexpand all lines: doc/scapy/development.rst
+31-6
Original file line number
Diff line number
Diff line change
@@ -300,10 +300,35 @@ publish the release::
300
300
Release Candidates (RC) could also be done. For example, the first RC will be
301
301
tagged v2.4.3rc1 and the message ``2.4.3 Release Candidate #1``.
302
302
303
-
Prior to uploading the release to PyPi, the ``author_email`` in ``setup.py``
304
-
must be changed to the address of the maintainer performing the release. The
305
-
following commands can then be used::
303
+
Prior to uploading the release to PyPi, the mail address of the maintainer
304
+
performing the release must be added next to his name in ``pyproject.toml``.
305
+
See `this <https://packaging.python.org/en/latest/specifications/declaring-project-metadata/#authors-maintainers>`_ for details.
306
306
307
-
python3 setup.py sdist
308
-
twine check dist/scapy-2.4.3.tar.gz
309
-
twine upload dist/scapy-2.4.3.tar.gz
307
+
The following commands can then be used::
308
+
309
+
pip install --upgrade build
310
+
python -m build
311
+
twine check dist/*
312
+
twine upload dist/*
313
+
314
+
.. warning::
315
+
Make sure that you don't have left-overs in your ``dist/`` folder ! There should only be the source and the wheel for the package.
316
+
Also check that the wheel ends in ``*-py3-none-any.whl`` !
317
+
318
+
319
+
Packaging Scapy
320
+
===============
321
+
322
+
When packaging Scapy, you should build the source while setting the ``SCAPY_VERSION`` variable, in order to make sure that the version remains consistent.
323
+
324
+
.. code:: bash
325
+
326
+
$ SCAPY_VERSION=2.5.0 python3 -m build
327
+
...
328
+
Successfully built scapy-2.5.0.tar.gz and scapy-2.5.0-py3-none-any.whl
329
+
330
+
If you want to test Scapy while packaging it, you are encouraged to use the ``./run_tests`` script with no arguments. It will run a subset of the tests that don't use any external dependency, and will be easier to test. The only dependency is ``tox``
If you always want the latest version with all new features and bugfixes, use Scapy's Git repository:
80
+
If you always want the latest version of Scapy with all new the features and bugfixes (but slightly less stable), you can install Scapy from its Git repository.
86
81
87
-
1. `Install the Git version control system <https://git-scm.com/book/en/v2/Getting-Started-Installing-Git>`_.
82
+
.. note:: If you don't want to clone Scapy, you can install the development version in one line using::
You can also download Scapy's `latest version <https://github.com/secdev/scapy/archive/master.zip>`_ in a zip file::
86
+
1. Check out a clone of Scapy's repository with `git <https://git-scm.com/book/en/v2/Getting-Started-Installing-Git>`_::
95
87
96
-
$ wget --trust-server-names https://github.com/secdev/scapy/archive/master.zip # or wget -O master.zip https://github.com/secdev/scapy/archive/master.zip
97
-
$ unzip master.zip
98
-
$ cd master
88
+
$ git clone https://github.com/secdev/scapy.git
89
+
$ cd scapy
99
90
100
-
3. Install Scapy in the standard `distutils<https://docs.python.org/3/distutils/setupscript.html>`_ way::
91
+
2. Install Scapy using `pip<https://docs.python.org/dev/installing/index.html>`_::
101
92
102
-
$ cd scapy
103
-
$ sudo python setup.py install
93
+
$ pip install .
104
94
105
-
If you used Git, you can always update to the latest version afterwards::
95
+
3. If you used Git, you can always update to the latest version afterwards::
106
96
107
97
$ git pull
108
-
$ sudo python setup.py install
98
+
$ pip install .
109
99
110
100
.. note::
111
101
112
-
You can run scapy without installing it using the ``run_scapy`` (unix) or ``run_scapy.bat`` (Windows) script or running it directly from the executable zip file (see the previous section).
102
+
You can run scapy without installing it using the ``run_scapy`` (unix) or ``run_scapy.bat`` (Windows) script.
113
103
114
104
Optional Dependencies
115
105
=====================
@@ -132,7 +122,7 @@ Here are the topics involved and some examples that you can use to try if your i
132
122
133
123
* 2D graphics. ``psdump()`` and ``pdfdump()`` need `PyX <http://pyx.sourceforge.net/>`_ which in turn needs a LaTeX distribution: `texlive (Unix) <http://www.tug.org/texlive/>`_ or `MikTex (Windows) <https://miktex.org/>`_.
134
124
135
-
Note: PyX requires version <=0.12.1 on Python 2.7. This means that on Python 2.7, it needs to be installed via ``pip install pyx==0.12.1``. Otherwise ``pip install pyx``
125
+
You can install pyx using ``pip install pyx``
136
126
137
127
.. code-block:: python
138
128
@@ -203,29 +193,29 @@ Linux native
203
193
204
194
Scapy can run natively on Linux, without libpcap.
205
195
206
-
* Install `Python 2.7 or 3.4+ <http://www.python.org>`_.
207
-
* Install `tcpdump<http://www.tcpdump.org>`_ and make sure it is in the $PATH. (It's only used to compile BPF filters (``-ddd option``))
* Install `libpcap<http://www.tcpdump.org>`_. (By default it will only be used to compile BPF filters)
208
198
* Make sure your kernel has Packet sockets selected (``CONFIG_PACKET``)
209
199
* If your kernel is < 2.6, make sure that Socket filtering is selected ``CONFIG_FILTER``)
210
200
211
201
Debian/Ubuntu/Fedora
212
202
--------------------
213
203
214
-
Make sure tcpdump is installed:
204
+
Make sure libpcap is installed:
215
205
216
206
- Debian/Ubuntu:
217
207
218
208
.. code-block:: text
219
209
220
-
$ sudo apt-get install tcpdump
210
+
$ sudo apt-get install libpcap-dev
221
211
222
212
- Fedora:
223
213
224
214
.. code-block:: text
225
215
226
-
$ yum install tcpdump
216
+
$ yum install libpcap-devel
227
217
228
-
Then install Scapy via ``pip`` or ``apt`` (bundled under ``python-scapy``)
218
+
Then install Scapy via ``pip`` or ``apt`` (bundled under ``python3-scapy``)
229
219
All dependencies may be installed either via the platform-specific installer, or via PyPI. See `Optional Dependencies <#optional-dependencies>`_ for more information.
230
220
231
221
@@ -278,7 +268,7 @@ In a similar manner, to install Scapy on OpenBSD 5.9+, you **may** want to insta
278
268
279
269
.. code-block:: text
280
270
281
-
$ doas pkg_add libpcap tcpdump
271
+
$ doas pkg_add libpcap
282
272
283
273
Then install Scapy via ``pip`` or ``pkg_add`` (bundled under ``python-scapy``)
284
274
All dependencies may be installed either via the platform-specific installer, or via PyPI. See `Optional Dependencies <#optional-dependencies>`_ for more information.
@@ -297,28 +287,23 @@ Solaris / SunOS requires ``libpcap`` (installed by default) to work.
297
287
Windows
298
288
-------
299
289
300
-
.. sectionauthor:: Dirk Loss <mail at dirk-loss.de>
290
+
You need to install Npcap in order to install Scapy on Windows (should also work with Winpcap, but unsupported nowadays):
301
291
302
-
Scapy is primarily being developed for Unix-like systems and works best on those platforms. But the latest version of Scapy supports Windows out-of-the-box. So you can use nearly all of Scapy's features on your Windows machine as well.
292
+
* Download link: `Npcap <https://nmap.org/npcap/>`_: `the latest version <https://nmap.org/npcap/#download>`_
293
+
* During installation:
294
+
* we advise to turn **off** the ``Winpcap compatibility mode``
295
+
* if you want to use your wifi card in monitor mode (if supported), make sure you enable the ``802.11`` option
303
296
304
-
.. image:: graphics/scapy-win-screenshot1.png
305
-
:scale:80
306
-
:align:center
307
-
308
-
You need the following software in order to install Scapy on Windows:
309
-
310
-
* `Python <http://www.python.org>`_: `Python 2.7.X or 3.4+ <https://www.python.org/downloads/>`_. After installation, add the Python installation directory and its \Scripts subdirectory to your PATH. Depending on your Python version, the defaults would be ``C:\Python27`` and ``C:\Python27\Scripts`` respectively.
311
-
* `Npcap <https://nmap.org/npcap/>`_: `the latest version <https://nmap.org/npcap/#download>`_. Default values are recommended. Scapy will also work with Winpcap.
312
-
* `Scapy <http://www.secdev.org/projects/scapy/>`_: `latest development version <https://github.com/secdev/scapy/archive/master.zip>`_ from the `Git repository <https://github.com/secdev/scapy>`_. Unzip the archive, open a command prompt in that directory and run ``python setup.py install``.
313
-
314
-
Just download the files and run the setup program. Choosing the default installation options should be safe. (In the case of ``Npcap``, Scapy **will work** with ``802.11`` option enabled. You might want to make sure that this is ticked when installing).
297
+
Once that is done, you can `continue with Scapy's installation <#latest-release>`_.
315
298
316
-
After all packages are installed, open a command prompt (cmd.exe) and run Scapy by typing ``scapy``. If you have set the PATH correctly, this will find a little batch file in your ``C:\Python27\Scripts`` directory and instruct the Python interpreter to load Scapy.
299
+
You should then be able to open a ``cmd.exe`` and just call ``scapy``. If not, you probably haven't enabled the "Add Python to PATH" option when installing Python. You can follow the instructions `over here <https://docs.python.org/3/using/windows.html#finding-the-python-executable>`_ to change that (or add it manually).
317
300
318
-
If really nothing seems to work, consider skipping the Windows version and using Scapy from a Linux Live CD -- either in a virtual machine on your Windows host or by booting from CDROM: An older version of Scapy is already included in grml and BackTrack for example. While using the Live CD you can easily upgrade to the latest Scapy version by using the `above installation methods <#installing-scapy-v2-x>`_.
0 commit comments