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

Correctly set up package_dir for src/ prefix #303

Merged
merged 2 commits into from Jan 4, 2020

Conversation

@uranusjr
Copy link
Contributor

uranusjr commented Dec 16, 2019

This adds something like

package_dir = \
{'': 'src'}

setup(...
      package_dir=package_dir,
)

to setup.py if the module is found inside a src/ prefix.

Fix #302.

Syntax reference: https://docs.python.org/3.9/distutils/setupscript.html#listing-whole-packages

@takluyver

This comment has been minimized.

Copy link
Owner

takluyver commented Dec 17, 2019

Looks reasonable, but can we have a test? The test_sdist module already has a handy function to get global variables from a generated setup.py, so it should be easy to add.

@@ -28,18 +28,22 @@ def __init__(self, name, directory='.'):
if osp.isdir(pkg_dir):
self.path = pkg_dir
self.is_package = True
self.prefix = ''
existing.add(pkg_dir)
elif osp.isfile(py_file):

This comment has been minimized.

Copy link
@takluyver

takluyver Dec 17, 2019

Owner

I just noticed that these elif should be if - we're checking that only one of the possible paths exists, but elif assumes that's the case and bypasses the check.

It's not related to this change, but if you're feeling keen, another PR to add a failing test and fix that would be welcome. If not, I'll get round to it at some point.

This comment has been minimized.

Copy link
@uranusjr

uranusjr Dec 25, 2019

Author Contributor

Does this mean that we want to implement additional checks to make sure the choices are mutually exclusive?

@uranusjr

This comment has been minimized.

Copy link
Contributor Author

uranusjr commented Dec 17, 2019

My work PC just broke down :( I’m sending it for replacement tomorrow and will come back to this when I can (hopefully not for too long).

@takluyver

This comment has been minimized.

Copy link
Owner

takluyver commented Dec 17, 2019

No problem, thanks for letting me know.

@uranusjr uranusjr force-pushed the uranusjr:src-prefix-setup-py branch from 8b538a1 to a96a5eb Dec 27, 2019
@takluyver takluyver merged commit 5f5a9ba into takluyver:master Jan 4, 2020
4 checks passed
4 checks passed
codecov/patch 100% of diff hit (target 86.26%)
Details
codecov/project 86.31% (+0.05%) compared to 2740492
Details
continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
uranusjr added a commit to uranusjr/flit that referenced this pull request Jan 6, 2020
@uranusjr uranusjr deleted the uranusjr:src-prefix-setup-py branch Jan 6, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Linked issues

Successfully merging this pull request may close these issues.

2 participants
You can’t perform that action at this time.