mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
+5
-3
@@ -128,7 +128,8 @@ def do_install_dependencies(dev=False, only=False, bare=False, allow_global=Fals
|
||||
if not bare:
|
||||
click.echo('Installing {0}...'.format(crayons.green(package_name)))
|
||||
|
||||
c = delegator.run('{0} install "{1}"'.format(which_pip(allow_global=allow_global), package_name),)
|
||||
# pip install:
|
||||
c = delegator.run('{0} install "{1}" --index-url {2}'.format(which_pip(allow_global=allow_global), package_name, project.source['url']))
|
||||
|
||||
if not bare:
|
||||
click.echo(crayons.blue(c.out))
|
||||
@@ -170,7 +171,7 @@ def do_lock(dev=False):
|
||||
|
||||
# Load the Pipfile and generate a lockfile.
|
||||
p = pipfile.load(project.pipfile_location)
|
||||
lockfile = json.loads(p.lock())
|
||||
lockfile = json.loads(p.freeze())
|
||||
|
||||
# Pip freeze development dependencies.
|
||||
c = delegator.run('{0} freeze'.format(which_pip()))
|
||||
@@ -370,7 +371,8 @@ def install(package_name=False, more_packages=False, r=False, dev=False, system=
|
||||
|
||||
click.echo('Installing {0}...'.format(crayons.green(package_name)))
|
||||
|
||||
c = delegator.run('{0} install "{1}"'.format(which_pip(allow_global=system), package_name))
|
||||
# pip install:
|
||||
c = delegator.run('{0} install "{1}" -i {2}'.format(which_pip(allow_global=system), package_name, project.source['url']))
|
||||
click.echo(crayons.blue(c.out))
|
||||
|
||||
# Ensure that package was successfully installed.
|
||||
|
||||
@@ -35,6 +35,11 @@ class Project(object):
|
||||
except RuntimeError:
|
||||
return None
|
||||
|
||||
@property
|
||||
def parsed_pipfile(self):
|
||||
with open(self.pipfile_location, 'r') as f:
|
||||
return toml.load(f)
|
||||
|
||||
@property
|
||||
def lockfile_location(self):
|
||||
return '{0}.lock'.format(self.pipfile_location)
|
||||
@@ -48,6 +53,13 @@ class Project(object):
|
||||
with open('Pipfile', 'w') as f:
|
||||
f.write(toml.dumps(data))
|
||||
|
||||
@property
|
||||
def source(self):
|
||||
if 'source' in self.parsed_pipfile:
|
||||
return self.parsed_pipfile['source'][0]
|
||||
else:
|
||||
return [{u'url': u'https://pypi.org/', u'verify_ssl': True}][0]
|
||||
|
||||
@staticmethod
|
||||
def remove_package_from_pipfile(package_name, dev=False):
|
||||
pipfile_path = pipfile.Pipfile.find()
|
||||
|
||||
Reference in New Issue
Block a user