-
-
Notifications
You must be signed in to change notification settings - Fork 649
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
Python 3 - fix cffi resolver issues #6225
Python 3 - fix cffi resolver issues #6225
Conversation
@@ -41,7 +41,7 @@ def execute(self): | |||
safe_concurrent_rename(pants_wd, tmp_trash) | |||
safe_concurrent_rename(tmpdir, pants_wd) | |||
|
|||
if self.get_options().async: | |||
if self.get_options()['async']: |
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.
async is a reserved word in Py3
new_exception = self.CacheValidationError("Problem validating target {} in {}: {}" | ||
.format(target.id, target.address.spec_path, e)) | ||
|
||
raise self.CacheValidationError, new_exception, exc_info[2] | ||
raise_from(self.CacheValidationError(new_exception), e) |
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.
raise from
is Python 3 syntactic sugar that provides the same functionality as exc_info[2]
.
@@ -27,7 +27,7 @@ pywatchman==1.4.1 | |||
requests[security]>=2.5.0,<2.19 | |||
scandir==1.2 | |||
setproctitle==1.1.10 | |||
setuptools==30.0.0 | |||
setuptools==33.1.1 |
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.
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.
Good catch. Fixed with latest commit. Thanks!
Problem
When running any unit test that extends
TestBase
with Python 3 on macOS (not tested on Linux), pants throws this exceptionException message: Package SourcePackage(u'file:///Users/earellano/.cache/pants/python_cache/requirements/CPython-3.7.0/cryptography-2.3.tar.gz') is not translateable by ChainedTranslator(WheelTranslator, EggTranslator, SourceTranslator)
I realized this is because I didn't have liffbfi and cffi installed, so I followed their install instructions. Our README already specifies you need these, so this is okay so far.
After installing liffbfi and cffi, I ran into a new exception:
Solution
Bumping setuptools to the max possible, 33.1.1, fixes the issue for me, when followed by
./pants clean-all
Note that setuptools goes all the way to 40.0, but PEX requires < 34.
To test locally
Add
compatibility='CPython>=3.5',
to the:meta
entry inpants_test/util/BUILD
. Then run./pants test tests/python/pants_test/util:meta
While the unit test itself will fail, the requirements resolver should pass.