Skip to content

Commit

Permalink
fixing some issues with install develop packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
toumorokoshi committed Jun 20, 2016
1 parent 845ba9a commit a160c21
Show file tree
Hide file tree
Showing 4 changed files with 32 additions and 11 deletions.
5 changes: 4 additions & 1 deletion makefile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,10 @@ test:
./uranium/scripts/uranium_standalone --uranium-dir=. test_no_deps ${ARGS}

test_full:
./uranium/scripts/uranium_standalone --uranium-dir=. test ${ARGS}
./uranium/scripts/uranium_standalone --uranium-dir=. test ${ARGS} -v

build:
./uranium/scripts/uranium_standalone --uranium-dir=.

distribute:
./uranium/scripts/uranium_standalone --uranium-dir=. distribute
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.38b',
version='0.2.43b',
description='a build system for python',
long_description=open('README.rst').read(),
author='Yusuke Tsutsumi',
Expand Down
12 changes: 6 additions & 6 deletions tests/packages/test_install_command.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,12 +6,12 @@ def test_create_args_includes_trusted_hosts():
if index urls are passed in, there should be a trusted host
argument returned.
"""
args = _create_args("pytest", index_urls=["http://pypi.python.org",
"http://pypi2.python.org"])
args = _create_args("pytest", index_urls=["http://pypi.python.org/simple",
"http://pypi2.python.org/simple"])
assert args == [
"-i", "http://pypi.python.org",
"--trusted-host", "http://pypi.python.org",
"--extra-index-url", "http://pypi2.python.org",
"--trusted-host", "http://pypi2.python.org",
"-i", "http://pypi.python.org/simple",
"--trusted-host", "pypi.python.org",
"--extra-index-url", "http://pypi2.python.org/simple",
"--trusted-host", "pypi2.python.org",
"pytest"
]
24 changes: 21 additions & 3 deletions uranium/packages/install_command.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from pip.commands import InstallCommand
from pip.req.req_file import process_line
from ..lib.compat import urlparse


class UraniumInstallCommand(InstallCommand):
Expand Down Expand Up @@ -30,7 +31,19 @@ def populate_requirement_set(self, requirement_set, args, options,
options=options, session=session,
wheel_cache=wheel_cache, constraint=True
):
requirement_set.add_requirement(req)
try:
existing_req = requirement_set.get_requirement(
package_name)
existing_req.req.specifier &= req.specifier
except KeyError:
requirement_set.add_requirement(req)
for r in requirement_set.unnamed_requirements:
if r.editable:
r.run_egg_info()
name = r.pkg_info()["name"]
if name in requirement_set.requirements:
del requirement_set.requirements._dict[name]
requirement_set.requirements._keys.remove(name)


def install(package_name, constraint_dict=None, **kwargs):
Expand All @@ -47,16 +60,21 @@ def install(package_name, constraint_dict=None, **kwargs):
return command.run(options, args)


def _get_netloc(url):
parsed_url = urlparse(url)
return parsed_url.netloc


def _create_args(package_name, upgrade=False, develop=False,
version=None, index_urls=None):
args = []

if index_urls:
args += ["-i", index_urls[0]]
args += ["--trusted-host", index_urls[0]]
args += ["--trusted-host", _get_netloc(index_urls[0])]
for url in index_urls[1:]:
args += ["--extra-index-url", url]
args += ["--trusted-host", url]
args += ["--trusted-host", _get_netloc(url)]

if upgrade:
args.append("--upgrade")
Expand Down

0 comments on commit a160c21

Please sign in to comment.