mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
$ pip install --requirements
This commit is contained in:
@@ -1,3 +1,5 @@
|
||||
3.1.4:
|
||||
- $ pip install --requirements.
|
||||
3.1.3:
|
||||
- Python 3 fix.
|
||||
3.1.2:
|
||||
|
||||
Generated
+72
-72
@@ -1,4 +1,76 @@
|
||||
{
|
||||
"default": {
|
||||
"crayons": {
|
||||
"version": "==0.1.2",
|
||||
"hash": "sha256:5e17691605e564d63482067eb6327d01a584bbaf870beffd4456a3391bd8809d"
|
||||
},
|
||||
"requirements-parser": {
|
||||
"version": "==0.1.0",
|
||||
"hash": "sha256:fee2380a469ffe4067bc7f0096a6fcfb27539da7496fae12b74b8d5d0f33a4ee"
|
||||
},
|
||||
"pexpect": {
|
||||
"version": "==4.2.1",
|
||||
"hash": "sha256:f853b52afaf3b064d29854771e2db509ef80392509bde2dd7a6ecf2dfc3f0018"
|
||||
},
|
||||
"delegator.py": {
|
||||
"version": "==0.0.8",
|
||||
"hash": "sha256:fbfbda2e36edb64250629a98911f8b0c8f5f66af5936608d1fb44d9b866c51d6"
|
||||
},
|
||||
"backports.shutil_get_terminal_size": {
|
||||
"version": "==1.0.0",
|
||||
"hash": "sha256:0975ba55054c15e346944b38956a4c9cbee9009391e41b86c68990effb8c1f64"
|
||||
},
|
||||
"ptyprocess": {
|
||||
"version": "==0.5.1",
|
||||
"hash": "sha256:464cb76f7a7122743dd25507650db89cd447c51f38e4671602b3eaa2e38e05ae"
|
||||
},
|
||||
"parse": {
|
||||
"version": "==1.6.6",
|
||||
"hash": "sha256:a4862be306f334c36ae7adc73af028c56ca0139b8e39435e935bde8d481dd99e"
|
||||
},
|
||||
"toml": {
|
||||
"version": "==0.9.2",
|
||||
"hash": "sha256:b3953bffe848ad9a6d554114d82f2dcb3e23945e90b4d9addc9956f37f336594"
|
||||
},
|
||||
"colorama": {
|
||||
"version": "==0.3.7",
|
||||
"hash": "sha256:a4c0f5bc358a62849653471e309dcc991223cf86abafbec17cd8f41327279e89"
|
||||
},
|
||||
"click": {
|
||||
"version": "==6.7",
|
||||
"hash": "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d"
|
||||
}
|
||||
},
|
||||
"develop": {
|
||||
"packaging": {
|
||||
"version": "==16.8",
|
||||
"hash": "sha256:99276dc6e3a7851f32027a68f1095cd3f77c148091b092ea867a351811cfe388"
|
||||
},
|
||||
"pytest": {
|
||||
"version": "==3.0.6",
|
||||
"hash": "sha256:da0ab50c7eec0683bc24f1c1137db1f4111752054ecdad63125e7ec71316b813"
|
||||
},
|
||||
"setuptools": {
|
||||
"version": "==34.0.2",
|
||||
"hash": "sha256:f9ac44de8b36a13ce35d2989052a295a548c9fe5a161fb066dff53592200aa12"
|
||||
},
|
||||
"pyparsing": {
|
||||
"version": "==2.1.10",
|
||||
"hash": "sha256:67101d7acee692962f33dd30b5dce079ff532dd9aa99ff48d52a3dad51d2fe84"
|
||||
},
|
||||
"py": {
|
||||
"version": "==1.4.32",
|
||||
"hash": "sha256:2d4bba2e25fff58140e6bdce1e485e89bb59776adbe01d490baa6b1f37a3dd6b"
|
||||
},
|
||||
"six": {
|
||||
"version": "==1.10.0",
|
||||
"hash": "sha256:0ff78c403d9bccf5a425a6d31a12aa6b47f1c21ca4dc2573a7e2f32a97335eb1"
|
||||
},
|
||||
"appdirs": {
|
||||
"version": "==1.4.0",
|
||||
"hash": "sha256:85e58578db8f29538f3109c11250c2a5514a2fcdc9890d9b2fe777eb55517736"
|
||||
}
|
||||
},
|
||||
"_meta": {
|
||||
"sources": [
|
||||
{
|
||||
@@ -8,77 +80,5 @@
|
||||
],
|
||||
"requires": {},
|
||||
"Pipfile-sha256": "bceb0e55b886dea8ff6ada0dfe673c18a010695c160b0643e93c0fb6c5337fd6"
|
||||
},
|
||||
"default": {
|
||||
"crayons": {
|
||||
"hash": "sha256:5e17691605e564d63482067eb6327d01a584bbaf870beffd4456a3391bd8809d",
|
||||
"version": "==0.1.2"
|
||||
},
|
||||
"requirements-parser": {
|
||||
"hash": "sha256:fee2380a469ffe4067bc7f0096a6fcfb27539da7496fae12b74b8d5d0f33a4ee",
|
||||
"version": "==0.1.0"
|
||||
},
|
||||
"delegator.py": {
|
||||
"hash": "sha256:fbfbda2e36edb64250629a98911f8b0c8f5f66af5936608d1fb44d9b866c51d6",
|
||||
"version": "==0.0.8"
|
||||
},
|
||||
"backports.shutil_get_terminal_size": {
|
||||
"hash": "sha256:0975ba55054c15e346944b38956a4c9cbee9009391e41b86c68990effb8c1f64",
|
||||
"version": "==1.0.0"
|
||||
},
|
||||
"parse": {
|
||||
"hash": "sha256:a4862be306f334c36ae7adc73af028c56ca0139b8e39435e935bde8d481dd99e",
|
||||
"version": "==1.6.6"
|
||||
},
|
||||
"toml": {
|
||||
"hash": "sha256:b3953bffe848ad9a6d554114d82f2dcb3e23945e90b4d9addc9956f37f336594",
|
||||
"version": "==0.9.2"
|
||||
},
|
||||
"click": {
|
||||
"hash": "sha256:29f99fc6125fbc931b758dc053b3114e55c77a6e4c6c3a2674a2dc986016381d",
|
||||
"version": "==6.7"
|
||||
},
|
||||
"colorama": {
|
||||
"hash": "sha256:a4c0f5bc358a62849653471e309dcc991223cf86abafbec17cd8f41327279e89",
|
||||
"version": "==0.3.7"
|
||||
},
|
||||
"pexpect": {
|
||||
"hash": "sha256:f853b52afaf3b064d29854771e2db509ef80392509bde2dd7a6ecf2dfc3f0018",
|
||||
"version": "==4.2.1"
|
||||
},
|
||||
"ptyprocess": {
|
||||
"hash": "sha256:464cb76f7a7122743dd25507650db89cd447c51f38e4671602b3eaa2e38e05ae",
|
||||
"version": "==0.5.1"
|
||||
}
|
||||
},
|
||||
"develop": {
|
||||
"pytest": {
|
||||
"hash": "sha256:da0ab50c7eec0683bc24f1c1137db1f4111752054ecdad63125e7ec71316b813",
|
||||
"version": "==3.0.6"
|
||||
},
|
||||
"appdirs": {
|
||||
"hash": "sha256:85e58578db8f29538f3109c11250c2a5514a2fcdc9890d9b2fe777eb55517736",
|
||||
"version": "==1.4.0"
|
||||
},
|
||||
"packaging": {
|
||||
"hash": "sha256:99276dc6e3a7851f32027a68f1095cd3f77c148091b092ea867a351811cfe388",
|
||||
"version": "==16.8"
|
||||
},
|
||||
"py": {
|
||||
"hash": "sha256:2d4bba2e25fff58140e6bdce1e485e89bb59776adbe01d490baa6b1f37a3dd6b",
|
||||
"version": "==1.4.32"
|
||||
},
|
||||
"pyparsing": {
|
||||
"hash": "sha256:67101d7acee692962f33dd30b5dce079ff532dd9aa99ff48d52a3dad51d2fe84",
|
||||
"version": "==2.1.10"
|
||||
},
|
||||
"setuptools": {
|
||||
"hash": "sha256:f9ac44de8b36a13ce35d2989052a295a548c9fe5a161fb066dff53592200aa12",
|
||||
"version": "==34.0.2"
|
||||
},
|
||||
"six": {
|
||||
"hash": "sha256:0ff78c403d9bccf5a425a6d31a12aa6b47f1c21ca4dc2573a7e2f32a97335eb1",
|
||||
"version": "==1.10.0"
|
||||
}
|
||||
}
|
||||
}
|
||||
+24
-13
@@ -47,7 +47,7 @@ def ensure_pipfile():
|
||||
# Assert Pipfile exists.
|
||||
if not project.pipfile_exists:
|
||||
|
||||
click.echo(crayons.yellow('Creating a Pipfile for this project...'))
|
||||
click.echo(crayons.yellow('Creating a Pipfile for this project...'), err=True)
|
||||
|
||||
# Create the pipfile if it doesn't exist.
|
||||
project.create_pipfile()
|
||||
@@ -60,8 +60,8 @@ def ensure_virtualenv(three=None):
|
||||
|
||||
# If --three / --two were passed...
|
||||
elif three is not None:
|
||||
click.echo(crayons.red('Virtualenv already exists!'))
|
||||
click.echo(crayons.yellow('Removing existing virtualenv...'))
|
||||
click.echo(crayons.red('Virtualenv already exists!'), err=True)
|
||||
click.echo(crayons.yellow('Removing existing virtualenv...'), err=True)
|
||||
|
||||
# Remove the virtualenv.
|
||||
shutil.rmtree(project.virtualenv_location)
|
||||
@@ -83,9 +83,9 @@ def do_where(virtualenv=False, bare=True):
|
||||
location = project.pipfile_location
|
||||
|
||||
if not location:
|
||||
click.echo('No Pipfile present at project home. Consider running {0} first to automatically generate a Pipfile for you.'.format(crayons.green('`pipenv install`')))
|
||||
click.echo('No Pipfile present at project home. Consider running {0} first to automatically generate a Pipfile for you.'.format(crayons.green('`pipenv install`')), err=True)
|
||||
elif not bare:
|
||||
click.echo('Pipfile found at {0}. Considering this to be the project home.'.format(crayons.green(location)))
|
||||
click.echo('Pipfile found at {0}. Considering this to be the project home.'.format(crayons.green(location)), err=True)
|
||||
else:
|
||||
click.echo(location)
|
||||
|
||||
@@ -98,9 +98,12 @@ def do_where(virtualenv=False, bare=True):
|
||||
click.echo(location)
|
||||
|
||||
|
||||
def do_install_dependencies(dev=False, only=False, bare=False, allow_global=False):
|
||||
def do_install_dependencies(dev=False, only=False, bare=False, requirements=False, allow_global=False):
|
||||
""""Executes the install functionality."""
|
||||
|
||||
if requirements:
|
||||
bare = True
|
||||
|
||||
# Load the Pipfile.
|
||||
p = pipfile.load(project.pipfile_location)
|
||||
|
||||
@@ -125,6 +128,13 @@ def do_install_dependencies(dev=False, only=False, bare=False, allow_global=Fals
|
||||
# Convert the deps to pip-compatible arguments.
|
||||
deps_path = convert_deps_to_pip(deps)
|
||||
|
||||
# --requirements was passed.
|
||||
if requirements:
|
||||
with open(deps_path, 'r') as f:
|
||||
click.echo(f.read())
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
# pip install:
|
||||
c = pip_install(r=deps_path, allow_global=allow_global)
|
||||
if not c.return_code == 0:
|
||||
@@ -327,7 +337,7 @@ def do_purge(bare=False, downloads=False, allow_global=False):
|
||||
click.echo(crayons.yellow('Environment now purged and fresh!'))
|
||||
|
||||
|
||||
def do_init(dev=False, skip_virtualenv=False, allow_global=False):
|
||||
def do_init(dev=False, requirements=False, skip_virtualenv=False, allow_global=False):
|
||||
"""Executes the init functionality."""
|
||||
|
||||
ensure_pipfile()
|
||||
@@ -350,15 +360,15 @@ def do_init(dev=False, skip_virtualenv=False, allow_global=False):
|
||||
|
||||
# Check that the hash of the Lockfile matches the lockfile's hash.
|
||||
if not lockfile['_meta']['Pipfile-sha256'] == p.hash:
|
||||
click.echo(crayons.red('Pipfile.lock out of date, updating...'))
|
||||
click.echo(crayons.red('Pipfile.lock out of date, updating...'), err=Tru)
|
||||
|
||||
do_lock()
|
||||
|
||||
do_install_dependencies(dev=dev, allow_global=allow_global)
|
||||
do_install_dependencies(dev=dev, requirements=requirements, allow_global=allow_global)
|
||||
|
||||
# Write out the lockfile if it doesn't exist.
|
||||
if not project.lockfile_exists:
|
||||
click.echo(crayons.yellow('Pipfile.lock not found, creating...'))
|
||||
click.echo(crayons.yellow('Pipfile.lock not found, creating...', err=Tru))
|
||||
do_lock()
|
||||
|
||||
# Activate virtualenv instructions.
|
||||
@@ -471,8 +481,9 @@ def cli(ctx, where=False, bare=False, three=False, help=False):
|
||||
@click.option('--dev','-d', is_flag=True, default=False, help="Install package(s) in [dev-packages].")
|
||||
@click.option('--three/--two', is_flag=True, default=None, help="Use Python 3/2 when creating virtualenv.")
|
||||
@click.option('--system', is_flag=True, default=False, help="System pip management.")
|
||||
@click.option('--requirements', is_flag=True, default=False, help="Just generate a requirements.txt.")
|
||||
@click.option('--lock', is_flag=True, default=False, help="Lock afterwards.")
|
||||
def install(package_name=False, more_packages=False, r=False, dev=False, three=False, system=False, lock=False):
|
||||
def install(package_name=False, more_packages=False, dev=False, three=False, system=False, lock=False, requirements=False):
|
||||
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(three=three)
|
||||
@@ -482,8 +493,8 @@ def install(package_name=False, more_packages=False, r=False, dev=False, three=F
|
||||
|
||||
# Install all dependencies, if none was provided.
|
||||
if package_name is False:
|
||||
click.echo(crayons.yellow('No package provided, installing all dependencies.'))
|
||||
do_init(dev=dev, allow_global=system)
|
||||
click.echo(crayons.yellow('No package provided, installing all dependencies.'), err=True)
|
||||
do_init(dev=dev, requirements=requirements, allow_global=system)
|
||||
sys.exit(0)
|
||||
|
||||
for package_name in package_names:
|
||||
|
||||
Reference in New Issue
Block a user