it works!

This commit is contained in:
2017-04-26 15:36:15 -04:00
parent 1477fc7294
commit 05e18ffec2
+22 -9
View File
@@ -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]