Skip to content

Commit

Permalink
fixing up pip integration to a more shallow version.
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Jun 15, 2016
1 parent 4bf0fcd commit 2d9a4f4
Show file tree
Hide file tree
Showing 10 changed files with 103 additions and 282 deletions.
3 changes: 3 additions & 0 deletions makefile
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
test:
./uranium/scripts/uranium_standalone --uranium-dir=. test_no_deps ${ARGS}

build:
./uranium/scripts/uranium_standalone --uranium-dir=.
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
]

setup(name='uranium',
version='0.2.35b',
version='0.2.36b',
description='a build system for python',
long_description=open('README.rst').read(),
author='Yusuke Tsutsumi',
Expand Down
3 changes: 1 addition & 2 deletions ubuild.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,9 @@
def _install_test_modules(build):
build.packages.versions.update({
"httpretty": "==0.8.10",
"pytest": "==2.8.2"
})

build.packages.install("pytest")
build.packages.install("pytest", version="==2.9.2")
build.packages.install("pytest-cov")
build.packages.install("httpretty")

Expand Down
2 changes: 1 addition & 1 deletion uranium/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# when attempting to use uranium within a sandbox.
import setuptools
# same with markerlib
import _markerlib
# import _markerlib

from .remote import get_remote_script
from .decorators import task_requires
Expand Down
141 changes: 0 additions & 141 deletions uranium/lib/pip_manager/__init__.py

This file was deleted.

61 changes: 0 additions & 61 deletions uranium/lib/pip_manager/req_set.py

This file was deleted.

57 changes: 0 additions & 57 deletions uranium/lib/pip_manager/specifier_set.py

This file was deleted.

35 changes: 20 additions & 15 deletions uranium/packages.py → uranium/packages/__init__.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
from .lib.pip_manager import PipManager
from .lib.asserts import get_assert_function
from .exceptions import PackageException
from ..lib.asserts import get_assert_function
from ..exceptions import PackageException
from .install_command import install

p_assert = get_assert_function(PackageException)

Expand All @@ -17,7 +17,7 @@ class Packages(object):

def __init__(self):
self._versions = {}
self._pip = PipManager(self._versions)
self._index_urls = list(DEFAULT_INDEX_URLS)

@property
def versions(self):
Expand Down Expand Up @@ -47,16 +47,15 @@ def index_urls(self):
index urls is a list of the urls that Packages queries when
looking for packages.
"""
return self._pip.index_urls
return self._index_urls

@index_urls.setter
def index_urls(self, value):
self._pip.index_urls = value
p_assert(isinstance(value, list),
"only lists can be set as a value for indexes")
self._pip.indexes = value
self._index_urls = value

def install(self, name, version=None, develop=None, upgrade=False):
def install(self, name, version=None, develop=False, upgrade=False):
"""
install is used when installing a python package into the environment.
Expand All @@ -66,12 +65,18 @@ def install(self, name, version=None, develop=None, upgrade=False):
in the directory passed will be used when using that package.
"""
p_assert(
version is None or develop is None,
not (develop and version),
"unable to set both version and develop flags when installing packages"
)
if develop:
self._pip.install_develop(name)
else:
if version:
self.versions.update({name: version})
self._pip.install(name, upgrade=upgrade)
if name in self.versions:
if version is None:
version = self.versions[name]
del self.versions[name]
req_set = install(
name, upgrade=upgrade, develop=develop, version=version,
index_urls=self.index_urls, constraint_dict=self.versions
)
if req_set:
for req in req_set.requirements.values():
if req.installed_version:
self.versions[req.name] = ("==" + req.installed_version)

0 comments on commit 2d9a4f4

Please sign in to comment.