-
-
Notifications
You must be signed in to change notification settings - Fork 1.4k
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
move extension into the package #578
Conversation
fed0781
to
d3e7b18
Compare
except ImportError: | ||
from distutils.core import setup, Extension | ||
|
||
from setuptools import setup, Extension |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why this? AFAIK setuptools is a third-party dep which is not installed by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
pip requires setuptools if installing from source. Wheels do not use the setup.py script. Both 'bootstrapped' in 2.7 & 3.4.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We still support python 2.6.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm eager to do this only if a brand new Python installation (2.6 included) has setuptools installed.
Thanks for writing this. The changes you did against the import system broke some imports on Python 3 though: |
@@ -134,6 +130,7 @@ def get_winver(): | |||
|
|||
def main(): | |||
setup_args = dict( | |||
zip_safe=False, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
According to this:
https://pythonhosted.org/setuptools/setuptools.html#setting-the-zip-safe-flag
...zip_safe=False
seems to be unnecessary because if the package contains C extension files (as psutil) zip_safe is already implicitly set to False. Given that zip_safe is an option which exists only if setuptools is installed I think it makes sense to remove it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep.
Also, once you manage to fix the imports don't forget to update README.rst and CREDITS.rst (add your name). |
I'm looking into the import failure on py 3.x. |
Yes, the import failure is because of the different names in setup.py. For example, in
|
9d52300
to
b33ad4c
Compare
finally fixed the tests. |
b33ad4c
to
4307c28
Compare
I dropped the setuptools stuff. |
CONN_LISTEN, | ||
CONN_CLOSING, | ||
CONN_NONE | ||
) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please don't do this for now. I'll think about whether I'm OK with this later.
I made different commits today and this PR cannot be merged cleanly anymore.
For some reason the py modules can be imported, as in:
...but the C extension modules are not found:
|
Note: travis tests pass so it seems to be a problem related with tox: |
OK, I solved the issue by adding "usedevelop = True" in the tox config file. I merged your PR as of |
Unfortunately I had to revert this change in 454b1ac because relative imports no longer works if I run the interactive interpreter from within psutil installation directory. |
Why on earth would you do that? Open an interactive interpreter a package and access the package?! And even if you must have this why revert the module move? You could have reverted only the relative imports. |
Well, when I work on psutil I have a shell open in psutil root directory so it's not rare I open up a python interpreter in order to try some stuff. I also sometimes executes scripts (import psutil) from within the root directory and the same issue occurs. I also reverted the changes in setup.py because the same problem applies. |
No description provided.