Skip to content

Commit 8d6dc0b

Browse files
authored
Python 2: Fix installing from source (#2298)
* Python 2: Fix installing from source `python2.7 -m pip install git+https://github.com...` doesn't install any packages. The auto-discovery doesn't work for the old setuptools version used in Python 2. https://setuptools.pypa.io/en/latest/userguide/package_discovery.html#flat-layout * Use Python 3 commandline tools in Docker images Since the Python 2 version was installed first, the Python 3 install didn't touch the existing shell script wrapper files.
1 parent 64d52b0 commit 8d6dc0b

File tree

5 files changed

+6
-7
lines changed

5 files changed

+6
-7
lines changed

MANIFEST.in

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,4 +6,4 @@ include *.md *.txt *.sh *.yml MANIFEST.in
66
recursive-include docs *.rst *.png Makefile *.py *.txt
77
recursive-include pwnlib *.py *.asm *.rst *.md *.txt *.sh __doc__ *.mako
88
recursive-include pwn *.py *.asm *.rst *.md *.txt *.sh
9-
recursive-exclude *.pyc
9+
global-exclude *.pyc

extra/docker/beta/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM pwntools/pwntools:stable
22

33
USER root
44
RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@beta \
5-
&& python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@beta
5+
&& python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@beta
66
RUN PWNLIB_NOTERM=1 pwn update
77
USER pwntools

extra/docker/dev/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM pwntools/pwntools:stable
22

33
USER root
44
RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@dev \
5-
&& python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@dev
5+
&& python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@dev
66
RUN PWNLIB_NOTERM=1 pwn update
77
USER pwntools

extra/docker/stable/Dockerfile

+1-1
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,6 @@ FROM pwntools/pwntools:base
22

33
USER root
44
RUN python2.7 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@stable \
5-
&& python3 -m pip install --upgrade git+https://github.com/Gallopsled/pwntools@stable
5+
&& python3 -m pip install --force-reinstall --upgrade git+https://github.com/Gallopsled/pwntools@stable
66
RUN PWNLIB_NOTERM=1 pwn update
77
USER pwntools

setup.py

+2-3
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,12 @@
33

44
import glob
55
import os
6-
import platform
7-
import subprocess
86
import sys
9-
import traceback
107
from distutils.command.install import INSTALL_SCHEMES
118
from distutils.sysconfig import get_python_inc
129
from distutils.util import convert_path
1310

11+
from setuptools import find_packages
1412
from setuptools import setup
1513

1614
# Get all template files
@@ -48,6 +46,7 @@
4846
if sys.version_info < (3, 4):
4947
import toml
5048
project = toml.load('pyproject.toml')['project']
49+
compat['packages'] = find_packages()
5150
compat['install_requires'] = project['dependencies']
5251
compat['name'] = project['name']
5352
if '--user' in sys.argv:

0 commit comments

Comments
 (0)