mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
it works!
This commit is contained in:
+22
-9
@@ -38,6 +38,9 @@ else:
|
||||
# |_| |_|| _/|___>|_|_||__/
|
||||
# |_|
|
||||
|
||||
# Packages that should be ignored later.
|
||||
BAD_PACKAGES = ['setuptools', 'pip', 'wheel', 'six', 'packaging', 'pyparsing', 'appdirs']
|
||||
|
||||
# Enable shell completion.
|
||||
click_completion.init()
|
||||
|
||||
@@ -90,17 +93,28 @@ def ensure_pipfile(validate=True):
|
||||
# Assert Pipfile exists.
|
||||
if not project.pipfile_exists:
|
||||
|
||||
# If there's a requirements file, but no Pipfile...
|
||||
if project.requirements_exists:
|
||||
click.echo(crayons.yellow('Requirements file found, instead of Pipfile! Converting...'))
|
||||
|
||||
# Create a Pipfile...
|
||||
project.create_pipfile()
|
||||
click.echo(crayons.yellow('Installing dependencies from \'requirements.txt\'...'))
|
||||
print '{0} install -r {1}'.format(which('pip'), project.requirements_location)
|
||||
delegator.run('{0} install -r {1}'.format(which('pip'), project.requirements_location))
|
||||
for line in delegator.run('{0} freeze'.format(which('pip'))).out.split('\n'):
|
||||
if line:
|
||||
print convert_deps_from_pip(line)
|
||||
|
||||
exit()
|
||||
click.echo(crayons.yellow('Installing dependencies from \'requirements.txt\'...'))
|
||||
|
||||
# Install everything from the requirements.txt.
|
||||
delegator.run('{0} install -r {1}'.format(which('pip'), project.requirements_location))
|
||||
installed = delegator.run('{0} freeze'.format(which('pip'))).out.split('\n')
|
||||
|
||||
# Remove setuptools and friends from installed, if present.
|
||||
for package_name in BAD_PACKAGES:
|
||||
for i, package in enumerate(installed):
|
||||
if package.startswith(package_name):
|
||||
del installed[i]
|
||||
|
||||
for package in installed:
|
||||
if package:
|
||||
project.add_package_to_pipfile(package)
|
||||
|
||||
else:
|
||||
click.echo(crayons.yellow('Creating a Pipfile for this project...'), err=True)
|
||||
@@ -537,7 +551,6 @@ def do_activate_virtualenv(bare=False):
|
||||
else:
|
||||
click.echo(activate_virtualenv())
|
||||
|
||||
|
||||
def do_purge(bare=False, downloads=False, allow_global=False):
|
||||
"""Executes the purge functionality."""
|
||||
|
||||
@@ -551,7 +564,7 @@ def do_purge(bare=False, downloads=False, allow_global=False):
|
||||
installed = freeze.split()
|
||||
|
||||
# Remove setuptools and friends from installed, if present.
|
||||
for package_name in ['setuptools', 'pip', 'wheel', 'six', 'packaging', 'pyparsing', 'appdirs']:
|
||||
for package_name in BAD_PACKAGES:
|
||||
for i, package in enumerate(installed):
|
||||
if package.startswith(package_name):
|
||||
del installed[i]
|
||||
|
||||
Reference in New Issue
Block a user