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

Ensure setup.py works again #1316

Merged
merged 1 commit into from
Nov 29, 2019
Merged

Conversation

Blaisorblade
Copy link
Contributor

While pip3 install . still works, python3 setup.py install does not (and
ditto for Python2), because subpackages of pygments don't get installed. Even
running find_packages on its own has consistent behavior:

$ python3
>>> from setuptools import setup, find_packages
>>> find_packages(exclude=['tests'])
['pygments', 'pygments.filters', 'pygments.lexers', 'pygments.formatters', 'pygments.styles']
>>> find_packages(include=['pygments'])
['pygments']

The bug seems to have been introduced in
8d0828b.

Tested on macOS 10.14 with Homebrew Python 2.7.17 and 3.7.5.

I'm no Python expert, but my fix is based on examples in https://setuptools.readthedocs.io/en/latest/setuptools.html#using-find-packages.

That packages does not recurse automatically is made clear by distutils docs:
https://docs.python.org/3.7/distutils/setupscript.html#listing-whole-packages.

While `pip3 install .` still works, `python3 setup.py install` does not (and
ditto for Python2), because subpackages of `pygments` don't get installed. Even
running `find_packages` on its own has consistent behavior:

```
$ python3
>>> from setuptools import setup, find_packages
>>> find_packages(exclude=['tests'])
['pygments', 'pygments.filters', 'pygments.lexers', 'pygments.formatters', 'pygments.styles']
>>> find_packages(include=['pygments'])
['pygments']
```

The bug seems to have been introduced in
8d0828b.

Tested on macOS 10.14 with Homebrew Python 2.7.17 and 3.7.5.
@birkenfeld
Copy link
Member

I tested this and was able to setup.py install fine inside a virtualenv, and all the subpackages were installed, and pygmentize worked.

But I only tested Py3.6 and a newish version of setuptools, so there might be some version specifics going on, and obviously you're right that packages lists have to be comprehensive.

So I'll give in and use exclude after all.

@birkenfeld birkenfeld merged commit 9afd6bd into pygments:master Nov 29, 2019
@birkenfeld
Copy link
Member

2.5.2 is released with this change.

@Blaisorblade Blaisorblade deleted the fix-setup-py branch November 29, 2019 10:14
@Anteru
Copy link
Collaborator

Anteru commented Nov 29, 2019

Uh, should this be include=["pygments.*", "pygments"]? Reading the documentation, we probably need wildcards there For exclusion, it should be ["tests", "tests.*"] -- see https://setuptools.readthedocs.io/en/latest/setuptools.html#using-find-packages.

@birkenfeld Do you want to change this yet again or leave as is?

@birkenfeld
Copy link
Member

Feel free :)

@Anteru
Copy link
Collaborator

Anteru commented Nov 29, 2019

Ok :)

@Anteru Anteru self-assigned this Nov 29, 2019
@Anteru
Copy link
Collaborator

Anteru commented Nov 29, 2019

Should be fixed for real in 01f05b4. Tried it locally using Python 2.7.

@birkenfeld
Copy link
Member

No need for a new release this time.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants