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

[BUG] _load_raw method of class PthDistributions has an issue from version 67.8.0 #4731

Open
morganw opened this issue Nov 5, 2024 · 1 comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.

Comments

@morganw
Copy link

morganw commented Nov 5, 2024

setuptools version

setuptools==67.8.0

Python version

Python3.11

OS

macOS

Additional environment information

No response

Description

just upgrade my python package with python setup.py install. but find that still link to old version package and find that the version was not deleted from easy-install.pth

looks like setuptools==67.7.2 is ok, but from setuptools==67.8.0, there is an issue in _load_raw method of class PthDistributions:

normalized_path = normalize_path(os.path.join(self.basedir, path)

it maybe should is paths[-1]=normalized_path = normalize_path(os.path.join(self.basedir, path))

the paths is not full path, so, there will be an issue in below find_distributions:

self.paths, self.dirty = self._load()
self._init_paths = self.paths[:]
super().init([], None, None)
for path in yield_lines(self.paths):
list(map(self.add, find_distributions(path, True)))

Expected behavior

when upgrade the package, the previous version should be remove from easy-install.pth and can link to the current version

How to Reproduce

  1. create a python package with version 1.0.27
  2. install it with python setup.py install
  3. change version to 1.0.28
  4. upgrade it with python setup.py install
  5. check if upgrade success, should have below message, if not, looks like upgrade failed.
    Copying test_cli-1.0.28-py3.9.egg to /usr/local/lib/python3.9/site-packages
    Removing test-cli 1.0.27 from easy-install.pth file
    Adding test-cli 1.0.28 to easy-install.pth file

Output

Copying test_cli-1.0.28-py3.9.egg to /usr/local/lib/python3.9/site-packages
Removing test-cli 1.0.27 from easy-install.pth file
Adding test-cli 1.0.28 to easy-install.pth file

@morganw morganw added bug Needs Triage Issues that need to be evaluated for severity and status. labels Nov 5, 2024
@abravalheri
Copy link
Contributor

Hi @morganw, please note that any easy-install solution or python setup.py XXX CLI commands, are deprecated and no longer receive first class support.

The recommended approach is as follows:

  1. Please make sure you have updated the package source code to include a pyproject.toml file with a [build-system] table, as documented in the user guide.
    • Note that you need to list all your build dependencies in the [build-system] requires field (e.g. if you use any non-stdlib library in your setup.py script.
    • Please also note that if you need to import your local folders in your setup.py script then you also need to manually add the local folder to sys.path or use build-backend = "setuptools.build_meta:__legacy__"
  2. Please use pip>=23 to install your package using pip install .

There is a old blog post with some extra details about the deprecation https://blog.ganssle.io/articles/2021/10/setup-py-deprecated.html.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Needs Triage Issues that need to be evaluated for severity and status.
Projects
None yet
Development

No branches or pull requests

2 participants