Skip to content

Egg include setup py#1554

Merged
pganssle merged 4 commits intopypa:masterfrom
shashanksingh28:egg_include_setup_py
Nov 4, 2018
Merged

Egg include setup py#1554
pganssle merged 4 commits intopypa:masterfrom
shashanksingh28:egg_include_setup_py

Conversation

@shashanksingh28
Copy link
Copy Markdown
Contributor

@shashanksingh28 shashanksingh28 commented Oct 28, 2018

Summary of changes

While creating sdists, we want the source dist .tar.gz to contain setup.py because this is what pip would use to install the source distribution. python setup.py sdist ensured setup.py was included because distutils by default adds the script_name that was executing the build process. However, for someone calling build_sdist('.') programatically, the script name is the script callind build_sdist function and not setup.py.

The problem is that sdist command uses the egg-info command to extract file list to be tar-ziped, which did not include setup.py as default (unless it was called via 'setup.py' as the script name). This fix adds an explicit check in the egg-info command for setup.py.

An alternative solution is solving this one level deeper at distutils add_defaults method which egg-info command uses.

Closes #1506

Will update changelog once we agree on the approach

Pull Request Checklist

  • Changes have tests
  • News fragment added in changelog.d. See documentation for details

@pganssle
Copy link
Copy Markdown
Member

@shashanksingh28 Can you add a changelog here? changelog.d/1554.change.rst

Comment thread setuptools/tests/test_sdist.py Outdated
Comment thread setuptools/tests/test_sdist.py Outdated
Comment thread setuptools/tests/test_build_meta.py Outdated
@pganssle
Copy link
Copy Markdown
Member

@gaborbernat Do you mind taking a look at this? Are there tests that cover your use case?

Copy link
Copy Markdown
Contributor

@gaborbernat gaborbernat left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It does solve my problem, thanks a lot !

Comment thread changelog.d/1554.change.rst Outdated
Comment thread setuptools/command/egg_info.py Outdated
Comment thread setuptools/tests/test_build_meta.py Outdated
Comment thread setuptools/tests/test_sdist.py
@pganssle pganssle force-pushed the egg_include_setup_py branch from 1e8cb17 to 421f49d Compare November 2, 2018 20:46
pganssle pushed a commit to shashanksingh28/setuptools that referenced this pull request Nov 2, 2018
This tests that `setup.py` is included by default in the distribution
with the egg_info command and when an sdist is built with
build_meta.build_sdist
@pganssle pganssle force-pushed the egg_include_setup_py branch from 421f49d to 932c72d Compare November 3, 2018 00:31
pganssle pushed a commit to shashanksingh28/setuptools that referenced this pull request Nov 3, 2018
@pganssle pganssle force-pushed the egg_include_setup_py branch from 932c72d to bff67db Compare November 3, 2018 17:09
@pganssle pganssle merged commit 46af765 into pypa:master Nov 4, 2018
@pganssle
Copy link
Copy Markdown
Member

pganssle commented Nov 4, 2018

@shashanksingh28 Thanks for your PR, and thanks for following up with all the changes!

@shashanksingh28
Copy link
Copy Markdown
Contributor Author

Thanks @pganssle and @gaborbernat for your help :) This was my first open source PR, will try to be more involved

@pganssle pganssle mentioned this pull request Nov 11, 2018
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.

build_meta does not include setup.py

3 participants