Skip to content

Commit

Permalink
Resolve only stable releases by default. (#4201)
Browse files Browse the repository at this point in the history
Upgrade to pex `1.2.0` to pickup control over pre-release resolution and
setup resolves to use only stable releases by default.
  • Loading branch information
jsirois authored Jan 25, 2017
1 parent 8da8fcf commit 4c14dbb
Show file tree
Hide file tree
Showing 6 changed files with 16 additions and 6 deletions.
4 changes: 2 additions & 2 deletions 3rdparty/python/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ isort==4.2.5
lmdb==0.89
Markdown==2.1.1
mock==1.3.0
packaging==16.7
packaging==16.8
pathspec==0.3.4
pep8==1.6.2
pex==1.1.20
pex==1.2.1
psutil==4.3.0
pyflakes==1.1.0
Pygments==1.4
Expand Down
3 changes: 2 additions & 1 deletion src/python/pants/backend/python/python_chroot.py
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,7 @@ def _resolve_multi(self, requirements, find_links):
platform=platform,
context=context,
cache=requirements_cache_dir,
cache_ttl=self._python_setup.resolver_cache_ttl)
cache_ttl=self._python_setup.resolver_cache_ttl,
allow_prereleases=self._python_setup.resolver_allow_prereleases)

return distributions
6 changes: 6 additions & 0 deletions src/python/pants/backend/python/python_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,8 @@ def register_options(cls, register):
default=10 * 365 * 86400, # 10 years.
help='The time in seconds before we consider re-resolving an open-ended requirement, '
'e.g. "flask>=0.2" if a matching distribution is available on disk.')
register('--resolver-allow-prereleases', advanced=True, type=bool, default=False,
fingerprint=True, help='Whether to include pre-releases when resolving requirements.')
register('--artifact-cache-dir', advanced=True, default=None, metavar='<dir>',
help='The parent directory for the python artifact cache. '
'If unspecified, a standard path under the workdir is used.')
Expand Down Expand Up @@ -82,6 +84,10 @@ def resolver_cache_dir(self):
def resolver_cache_ttl(self):
return self.get_options().resolver_cache_ttl

@property
def resolver_allow_prereleases(self):
return self.get_options().resolver_allow_prereleases

@property
def artifact_cache_dir(self):
"""Note that this is unrelated to the general pants artifact cache."""
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -151,6 +151,7 @@ def _resolve_multi(self, interpreter, requirements, find_links):
platform=None if platform == 'current' else platform,
context=python_repos.get_network_context(),
cache=requirements_cache_dir,
cache_ttl=python_setup.resolver_cache_ttl)
cache_ttl=python_setup.resolver_cache_ttl,
allow_prereleases=python_setup.resolver_allow_prereleases)

return distributions
1 change: 1 addition & 0 deletions src/python/pants/bin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ python_library(
'src/python/pants/subsystem:subsystem',
'src/python/pants/util:dirutil',
'src/python/pants/util:memo',
'src/python/pants:version',
]
)

Expand Down
5 changes: 3 additions & 2 deletions src/python/pants/bin/plugin_resolver.py
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
from pants.subsystem.subsystem import Subsystem
from pants.util.dirutil import safe_open
from pants.util.memo import memoized_property

from pants.version import PANTS_SEMVER

logger = logging.getLogger(__name__)

Expand Down Expand Up @@ -90,7 +90,8 @@ def _resolve_plugins(self):
context=self._python_repos.get_network_context(),
precedence=precedence,
cache=self.plugin_cache_dir,
cache_ttl=self._python_setup.resolver_cache_ttl)
cache_ttl=self._python_setup.resolver_cache_ttl,
allow_prereleases=PANTS_SEMVER.is_prerelease)

@memoized_property
def plugin_cache_dir(self):
Expand Down

0 comments on commit 4c14dbb

Please sign in to comment.