Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

plux entrypoints adds absolute path to setup.py to SOURCES.txt #23

Open
alexrashed opened this issue Jul 18, 2024 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@alexrashed
Copy link
Member

With localstack/localstack-cli#27, we are currently trying to migrate our PyInstaller binary CLI build of the LocalStack CLI to our new namespace packaging (which was recently introduced).
We are now at a state where only the Windows build failed with the following error:

...
reading manifest file 'localstack_ext.egg-info\SOURCES.txt'
  Traceback (most recent call last):
    File "D:\a\localstack-cli\localstack-cli\.venv\Lib\site-packages\pip\_vendor\pyproject_hooks\_in_process\_in_process.py", line 353, in <module>
...
    File "C:\Users\runneradmin\AppData\Local\Temp\pip-build-env-a5jadoa9\overlay\Lib\site-packages\setuptools\_distutils\util.py", line 133, in convert_path
      raise ValueError(f"path '{pathname}' cannot be absolute")
  ValueError: path '/home/runner/actions-runner/_work/localstack-ext/localstack-ext/localstack-pro-core/setup.py' cannot be absolute
  [end of output]
...

It seems that the execution of python3 -m plux entrypoints does add an absolute path to the setup.py in the SOURCES.txt in the egg_info folder (which causes issues only on Windows). Here's a quick reproducer in localstack/localstack:

mkdir /tmp/plux-test && cd /tmp/plux-test
git clone [email protected]:localstack/localstack.git
cd localstack
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements-dev.txt
cd localstack-pro-core
python3 -m plux entrypoints
cat localstack-core/localstack_core.egg-info/SOURCES.txt | grep -E ^/
# -> /tmp/test/localstack/setup.py

Replacing python3 -m plux entrypoints with python3 -m setup plugins egg_info works just fine:

cd /tmp/plux-test/localstack &&  rm -rf localstack-core/localstack_core.egg-info
source .venv/bin/activate
cd localstack-pro-core
python3 -m setup plugins egg_info
cat localstack-core/localstack_core.egg-info/SOURCES.txt | grep -E ^/
# Command fails because SOURCES.txt does not contain any absolute paths

I am actually not sure what causes this, plux really basically just calls these two setuptools commands:

plux/plux/cli/cli.py

Lines 22 to 26 in 8a5b759

print("discovering plugins ...")
dist.run_command("plugins")
print(f"building {dist.get_name().replace('-', '_')}.egg-info...")
dist.run_command("egg_info")

@Pive01
Copy link

Pive01 commented Aug 27, 2024

This is also failing on Linux when trying to build extension https://github.com/localstack/altimeter-ext/tree/ed1485d557e8606e5c553b6ff6801411adc9f2dc

I can see that when trying to build the .whl file I get

...
writing requirements to backend/resource_graph.egg-info/requires.txt
writing top-level names to backend/resource_graph.egg-info/top_level.txt
writing entry points to backend/resource_graph.egg-info/entry_points.txt
reading manifest file 'backend/resource_graph.egg-info/SOURCES.txt'
writing manifest file 'backend/resource_graph.egg-info/SOURCES.txt'
error: Error: setup script specifies an absolute path:

    /home/luca/Code/altimeter-ext/pyproject.toml

setup() arguments must *always* be /-separated paths relative to the
setup.py directory, *never* absolute paths.


ERROR Backend subprocess exited when trying to invoke build_wheel

If I look inside the SOURCES.txt (inside .egg.info) I can see

README.md
pyproject.toml
/home/luca/Code/altimeter-ext/pyproject.toml
backend/resource_graph/__init__.py
backend/resource_graph/config.py
...

Which is the only place I could find an absolute path so I'm fairly sure this is the issue

Installing dependencies with python3 -c "from setuptools import setup; setup()" plugins egg_info instead of python -m plux entrypoints seems to solve the issue as if I look again inside the SOURCES.txt now I can see

README.md
pyproject.toml
backend/resource_graph/__init__.py
backend/resource_graph/config.py
backend/resource_graph/extension.py
...

(aka no absolute path present)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

3 participants