proxy.py
proxy.py copied to clipboard
[Make] Unable to build container locally
Describe the bug Docker image not building
To Reproduce git clone ... make container
Expected behavior Build of Docker image
Version information
- OS: Ubuntu
Additional context
jdelrue@jdelrue-ryzen:~/code$ cd proxy.py && make container
find . -name '*.pyc' -exec rm -f {} +
find . -name '*.pyo' -exec rm -f {} +
find . -name '*~' -exec rm -f {} +
rm -f .coverage
rm -rf htmlcov
rm -rf dist
rm -rf build
rm -rf proxy.py.egg-info
rm -rf .pytest_cache
rm -rf .hypothesis
# Doc RST files are cached and can cause issues
# See https://github.com/abhinavsingh/proxy.py/issues/642#issuecomment-1003444578
rm -f docs/pkg/*.rst
python check.py
Traceback (most recent call last):
File "/home/jdelrue/code/proxy.py/proxy/common/_version.py", line 18, in <module>
from ._scm_version import version as __version__ # noqa: WPS433, WPS436
ModuleNotFoundError: No module named 'proxy.common._scm_version'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "check.py", line 15, in <module>
from proxy.common.version import __version__ as lib_version
File "/home/jdelrue/code/proxy.py/proxy/__init__.py", line 11, in <module>
from .proxy import Proxy, main, sleep_loop, entry_point
File "/home/jdelrue/code/proxy.py/proxy/proxy.py", line 20, in <module>
from .core.ssh import SshTunnelListener, SshHttpProtocolHandler
File "/home/jdelrue/code/proxy.py/proxy/core/ssh/__init__.py", line 16, in <module>
from .listener import SshTunnelListener
File "/home/jdelrue/code/proxy.py/proxy/core/ssh/listener.py", line 26, in <module>
from ...common.flag import flags
File "/home/jdelrue/code/proxy.py/proxy/common/flag.py", line 23, in <module>
from .utils import bytes_, is_py2, is_threadless, set_open_file_limit
File "/home/jdelrue/code/proxy.py/proxy/common/utils.py", line 27, in <module>
from .constants import (
File "/home/jdelrue/code/proxy.py/proxy/common/constants.py", line 21, in <module>
from .version import __version__
File "/home/jdelrue/code/proxy.py/proxy/common/version.py", line 11, in <module>
from ._version import VERSION, __version__ # noqa: WPS436
File "/home/jdelrue/code/proxy.py/proxy/common/_version.py", line 22, in <module>
__version__ = _get_dist('proxy.py').version # noqa: WPS440
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 482, in get_distribution
dist = get_provider(dist)
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 358, in get_provider
return working_set.find(moduleOrReq) or require(str(moduleOrReq))[0]
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 901, in require
needed = self.resolve(parse_requirements(requirements))
File "/usr/lib/python3/dist-packages/pkg_resources/__init__.py", line 787, in resolve
raise DistributionNotFound(req, requirers)
pkg_resources.DistributionNotFound: The 'proxy.py' distribution was not found and is required by the application
make: *** [Makefile:84: lib-check] Error 1
Did some digging:
- Had to run write-scm-version.sh (is not in the readme)
- Had to change the file write-scm-version.sh
diff --git a/write-scm-version.sh b/write-scm-version.sh
index 1f01e70..141eb93 100755
--- a/write-scm-version.sh
+++ b/write-scm-version.sh
@@ -14,9 +14,9 @@
# will be re-written.
# Guessed Version 2.3.2.dev146+gad54132.d20211114
-VERSION=$(python -m setuptools_scm --version | \
+VERSION=$(python -m setuptools_scm | \
# 2.3.2.dev146+gad54132.d20211114
- awk '{print $3}')
+ awk '{print $1}')
# Store default IFS
OLDIFS=$IFS
Had to install some dependencies:
sudo apt install python3.8-venv
sudo pip install tox setuptools-scm
And I got the container building
Thank you for the diff. Once we integrated GHA container built, local flow was not kept in sync or tested. I'll update these patches into write scm version.
Note that you can just do pip install -e .
which is equivalent to everything you had to do before make container.