Skip to content
This repository has been archived by the owner on Dec 4, 2023. It is now read-only.

Commit

Permalink
Moved dependency check to runtime. Fixes #40.
Browse files Browse the repository at this point in the history
  • Loading branch information
jaraco committed Mar 18, 2018
1 parent 1d547a0 commit 8355b65
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGES.rst
Original file line number Diff line number Diff line change
@@ -1,3 +1,9 @@
4.2
===

* #40: Remove declared dependency and instead assert it at
run time.

4.1
===

Expand Down
12 changes: 12 additions & 0 deletions ptr.py
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,18 @@ def initialize_options(self):
self.index_url = None
self.allow_hosts = None
self.addopts = []
self.ensure_setuptools_version()

@staticmethod
def ensure_setuptools_version():
"""
Due to the fact that pytest-runner is often required (via
setup-requires directive) by toolchains that never invoke
it (i.e. they're only installing the package, not testing it),
instead of declaring the dependency in the package
metadata, assert the requirement at run time.
"""
pkg_resources.require('setuptools>=27.3')

def finalize_options(self):
if self.addopts:
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@
py_modules=['ptr'],
python_requires='>=2.7,!=3.0,!=3.1',
install_requires=[
'setuptools>=27.3',
# setuptools 27.3 is required at run time
],
extras_require={
'testing': [
Expand Down

3 comments on commit 8355b65

@bilderbuchi
Copy link

Choose a reason for hiding this comment

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

I'm not familiar enough probably with pytest-runner internals, but don't you have to call this function somewhere for that check to execute?

@jaraco
Copy link
Contributor Author

@jaraco jaraco commented on 8355b65 Apr 10, 2018

Choose a reason for hiding this comment

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

It's called there at ptr.py:96.

@bilderbuchi
Copy link

Choose a reason for hiding this comment

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

argh >.< I missed that, thank you!

Please sign in to comment.