Skip to content

Issue related to setup_requires (since #1150) #1273

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

Closed
astrofrog opened this issue Feb 8, 2018 · 2 comments
Closed

Issue related to setup_requires (since #1150) #1273

astrofrog opened this issue Feb 8, 2018 · 2 comments

Comments

@astrofrog
Copy link

For one of the projects I work on (Astropy) we have been making use of code that can be simplified to:

import pkg_resources
from setuptools import Distribution


class CustomDistribution(Distribution):
    def get_option_dict(self, command_name):
        opts = Distribution.get_option_dict(self, command_name)
        if command_name == 'easy_install':
            opts['find_links'] = ('setup script', ['astropy-helpers-2.0.3.tar.gz'])
            opts['allow_hosts'] = ('setup script', '')
        return opts


CustomDistribution(attrs={'setup_requires': ['astropy-helpers']})

print(pkg_resources.working_set.by_key.get('astropy-helpers'))

This requires the following tar file to run: astropy-helpers-2.0.3.tar.gz

Before #1150, this would cause astropy-helpers to be installed to the .eggs directory using the local tar file, but since the changes in #1150 this no longer works (in the above example, the last line used to return a distribution object, but astropy-helpers is now no longer in the working_set so this returns None)

Is this an unintended consequence of #1150, or should we update our code above for it to continue working?

cc @benoit-pierre @jaraco

@benoit-pierre
Copy link
Member

Requirements in setup_requires are now installed by setup before creating the Distribution object, not in the Distribution.__init__ phase anymore. Why don't you use setup.cfg and let setup do it for you? Is it because you need astropy-helpers available before calling setup? In which case you can use fetch_build_eggs directly (see example).

@astrofrog
Copy link
Author

astrofrog commented Feb 10, 2018

@benoit-pierre - ok, thanks for the clarification, I'll switch to calling fetch_build_eggs directly instead. We do need astropy-helpers to be available before calling setup. Thanks!

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

No branches or pull requests

2 participants