forked from pantsbuild/pants
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This hacks around a few issues with the 1.4.x pex API. We concoct a minimal local `Platform` to pass to `resolve` where a local interpreter is passed to work around pex-tool/pex#511. We also now consolidate `PythonInterpreter` construction in production code to helper that ensures the interpreters we create are bare (isolated) except for the specific extras we require to work around pex-tool/pex#510. Upgrading pex to take advantage of the worked around issues noted above is tracked by pantsbuild#5922. Fixes pantsbuild#5906
- Loading branch information
Showing
10 changed files
with
134 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
# coding=utf-8 | ||
# Copyright 2016 Pants project contributors (see CONTRIBUTORS.md). | ||
# Licensed under the Apache License, Version 2.0 (see LICENSE). | ||
|
||
from __future__ import (absolute_import, division, generators, nested_scopes, print_function, | ||
unicode_literals, with_statement) | ||
|
||
from pex.interpreter import PythonInterpreter | ||
from pex.platforms import Platform | ||
|
||
|
||
def create_bare_interpreter(binary_path): | ||
"""Creates an interpreter for python binary at the given path. | ||
The interpreter is bare in that it has no extras associated with it. | ||
:returns: A bare python interpreter with no extras. | ||
:rtype: :class:`pex.interpreter.PythonInterpreter` | ||
""" | ||
# TODO(John Sirois): Replace with a more direct PythonInterpreter construction API call when | ||
# https://github.com/pantsbuild/pex/issues/510 is fixed. | ||
interpreter_with_extras = PythonInterpreter.from_binary(binary_path) | ||
return PythonInterpreter(binary_path, interpreter_with_extras.identity, extras=None) | ||
|
||
|
||
def get_local_platform(): | ||
"""Returns the name of the local platform; eg: 'linux_x86_64' or 'macosx_10_8_x86_64'. | ||
:returns: The local platform name. | ||
:rtype: str | ||
""" | ||
# TODO(John Sirois): Kill some or all usages when https://github.com/pantsbuild/pex/issues/511 | ||
# is fixed. | ||
current_platform = Platform.current() | ||
return current_platform.platform |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.