mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
preliminary pip support
This commit is contained in:
@@ -13,3 +13,4 @@ parse = "*"
|
||||
pipfile = "==0.0.1"
|
||||
click-completion = "*"
|
||||
"backports.shutil-get-terminal-size" = "*"
|
||||
pew = ">=0.1.26"
|
||||
|
||||
+11
-6
@@ -306,7 +306,7 @@ def do_create_virtualenv(three=None, python=None):
|
||||
click.echo(crayons.yellow('Creating a virtualenv for this project...'), err=True)
|
||||
|
||||
# The command to create the virtualenv.
|
||||
cmd = ['virtualenv', project.virtualenv_location, '--prompt=({0})'.format(project.name)]
|
||||
cmd = ['pew', 'new', project.name, '-d']
|
||||
|
||||
# Pass a Python version to virtualenv, if needed.
|
||||
if python:
|
||||
@@ -658,6 +658,11 @@ def easter_egg(package_name):
|
||||
@click.version_option(prog_name=crayons.yellow('pipenv'), version=__version__)
|
||||
@click.pass_context
|
||||
def cli(ctx, where=False, bare=False, three=False, python=False, help=False):
|
||||
|
||||
|
||||
# print project.virtualenv_location
|
||||
# exit()
|
||||
|
||||
if ctx.invoked_subcommand is None:
|
||||
# --where was passed...
|
||||
if where:
|
||||
@@ -668,6 +673,9 @@ def cli(ctx, where=False, bare=False, three=False, python=False, help=False):
|
||||
if (python) or (three is not None):
|
||||
ensure_project(three=three, python=python)
|
||||
|
||||
|
||||
|
||||
|
||||
else:
|
||||
|
||||
# Display help to user, if no commands were passed.
|
||||
@@ -830,17 +838,14 @@ def shell(three=None, python=False):
|
||||
terminal_dimensions = get_terminal_size()
|
||||
|
||||
c = pexpect.spawn(
|
||||
shell,
|
||||
["-i"],
|
||||
'pew',
|
||||
["workon", project.name],
|
||||
dimensions=(
|
||||
terminal_dimensions.lines,
|
||||
terminal_dimensions.columns
|
||||
)
|
||||
)
|
||||
|
||||
# Activate the virtualenv.
|
||||
c.send(activate_virtualenv() + '\n')
|
||||
|
||||
# Handler for terminal resizing events
|
||||
# Must be defined here to have the shell process in its context, since we
|
||||
# can't pass it as an argument
|
||||
|
||||
+4
-2
@@ -4,6 +4,7 @@ import os
|
||||
import pipfile
|
||||
import toml
|
||||
|
||||
import delegator
|
||||
from requests.compat import OrderedDict
|
||||
|
||||
from .utils import format_toml, mkdir_p
|
||||
@@ -29,11 +30,12 @@ class Project(object):
|
||||
|
||||
@property
|
||||
def virtualenv_location(self):
|
||||
return os.sep.join(self.pipfile_location.split(os.sep)[:-1] + ['.venv'])
|
||||
c = delegator.run('pew dir {0}'.format(self.name))
|
||||
return c.out.strip()
|
||||
|
||||
@property
|
||||
def download_location(self):
|
||||
d_dir = os.sep.join(self.pipfile_location.split(os.sep)[:-1] + ['.venv', 'downloads'])
|
||||
d_dir = os.sep.join(self.virtualenv_location.split(os.sep) + ['downloads'])
|
||||
|
||||
# Create the directory, if it doesn't exist.
|
||||
mkdir_p(d_dir)
|
||||
|
||||
Reference in New Issue
Block a user