mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge branch 'master' into fix-several-general-options
This commit is contained in:
@@ -1,4 +1,22 @@
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: $(python.version)
|
||||
architecture: '$(python.architecture)'
|
||||
addToPath: true
|
||||
displayName: Use Python $(python.version)
|
||||
|
||||
- template: install-dependencies.yml
|
||||
|
||||
- script: |
|
||||
echo '##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]'$(python.version)
|
||||
env:
|
||||
PYTHON_VERSION: $(python.version)
|
||||
|
||||
- template: create-virtualenv.yml
|
||||
parameters:
|
||||
python_version: $(python.version)
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade wheel pip setuptools twine readme_renderer[md]
|
||||
python setup.py sdist bdist_wheel
|
||||
|
||||
@@ -1,3 +1,6 @@
|
||||
parameters:
|
||||
python_version: ''
|
||||
|
||||
steps:
|
||||
|
||||
- script: |
|
||||
@@ -29,10 +32,13 @@ steps:
|
||||
- script: |
|
||||
echo "Python path: $(PY_EXE)"
|
||||
echo "GIT_SSL_CAINFO: $(GIT_SSL_CAINFO)"
|
||||
echo "PIPENV PYTHON VERSION: $PIPENV_DEFAULT_PYTHON_VERSION"
|
||||
echo "PIPENV PYTHON VERSION: $(python.version)"
|
||||
echo "python_version: ${{ parameters.python_version }}"
|
||||
git submodule sync
|
||||
git submodule update --init --recursive
|
||||
$(PY_EXE) -m pipenv install --deploy --dev --python="$(PY_EXE)"
|
||||
env:
|
||||
PIPENV_DEFAULT_PYTHON_VERSION: $(python.version)
|
||||
PIPENV_DEFAULT_PYTHON_VERSION: ${{ parameters.python_version }}
|
||||
PYTHONWARNINGS: 'ignore:DEPRECATION'
|
||||
PIPENV_NOSPIN: '1'
|
||||
displayName: Make Virtualenv
|
||||
|
||||
@@ -4,15 +4,11 @@ parameters:
|
||||
steps:
|
||||
- script: |
|
||||
# Fix Git SSL errors
|
||||
echo "Using pipenv python version: $PIPENV_DEFAULT_PYTHON_VERSION"
|
||||
echo "Using pipenv python version: $(PIPENV_DEFAULT_PYTHON_VERSION)"
|
||||
git submodule sync && git submodule update --init --recursive
|
||||
pipenv run pytest --junitxml=test-results.xml
|
||||
displayName: Run integration tests
|
||||
env:
|
||||
PY_EXE: $(PY_EXE)
|
||||
GIT_SSL_CAINFO: $(GIT_SSL_CAINFO)
|
||||
LANG: $(LANG)
|
||||
PIP_PROCESS_DEPENDENCY_LINKS: '$(PIP_PROCESS_DEPENDENCY_LINKS)'
|
||||
PIPENV_DEFAULT_PYTHON_VERSION: '${{ parameters.python_version }}'
|
||||
PYTHONWARNINGS: ignore:DEPRECATION
|
||||
PIPENV_NOSPIN: '1'
|
||||
PIPENV_DEFAULT_PYTHON_VERSION: ${{ parameters.python_version }}
|
||||
|
||||
@@ -6,14 +6,16 @@ steps:
|
||||
subst T: "$env:TEMP"
|
||||
Write-Host "##vso[task.setvariable variable=TEMP]T:\"
|
||||
Write-Host "##vso[task.setvariable variable=TMP]T:\"
|
||||
Write-Host "##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]$env:PYTHON_VERSION"
|
||||
Write-Host "##vso[task.setvariable variable=PIPENV_NOSPIN]1"
|
||||
displayName: Fix Temp Variable
|
||||
env:
|
||||
PYTHON_VERSION: ${{ parameters.python_version }}
|
||||
|
||||
- script: |
|
||||
echo "Using pipenv python version: $PIPENV_DEFAULT_PYTHON_VERSION"
|
||||
git submodule sync && git submodule update --init --recursive
|
||||
pipenv run pytest -ra --ignore=pipenv\patched --ignore=pipenv\vendor --junitxml=test-results.xml tests
|
||||
displayName: Run integration tests
|
||||
env:
|
||||
PIPENV_DEFAULT_PYTHON_VERSION: '${{ parameters.python_version }}'
|
||||
PYTHONWARNINGS: 'ignore:DEPRECATION'
|
||||
PIPENV_NOSPIN: '1'
|
||||
|
||||
@@ -9,7 +9,7 @@ steps:
|
||||
- template: install-dependencies.yml
|
||||
|
||||
- script: |
|
||||
echo '##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]$(python.version)'
|
||||
echo '##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]'$(python.version)
|
||||
env:
|
||||
PYTHON_VERSION: $(python.version)
|
||||
|
||||
|
||||
@@ -2,6 +2,24 @@ parameters:
|
||||
python_version: ''
|
||||
|
||||
steps:
|
||||
- task: UsePythonVersion@0
|
||||
inputs:
|
||||
versionSpec: $(python.version)
|
||||
architecture: '$(python.architecture)'
|
||||
addToPath: true
|
||||
displayName: Use Python $(python.version)
|
||||
|
||||
- template: install-dependencies.yml
|
||||
|
||||
- script: |
|
||||
echo '##vso[task.setvariable variable=PIPENV_DEFAULT_PYTHON_VERSION]'$(python.version)
|
||||
env:
|
||||
PYTHON_VERSION: $(python.version)
|
||||
|
||||
- template: create-virtualenv.yml
|
||||
parameters:
|
||||
python_version: $(python.version)
|
||||
|
||||
- script: |
|
||||
python -m pip install --upgrade invoke requests parver bs4 vistir towncrier pip setuptools wheel --upgrade-strategy=eager
|
||||
python -m invoke vendoring.update
|
||||
|
||||
@@ -25,3 +25,6 @@
|
||||
[submodule "tests/test_artifacts/git/requests-2.18.4"]
|
||||
path = tests/test_artifacts/git/requests-2.18.4
|
||||
url = https://github.com/requests/requests
|
||||
[submodule "tests/pypi"]
|
||||
path = tests/pypi
|
||||
url = https://github.com/sarugaku/pipenv-test-artifacts.git
|
||||
|
||||
+25
-6
@@ -18,6 +18,9 @@ trigger:
|
||||
- .gitattributes
|
||||
- .editorconfig
|
||||
|
||||
variables:
|
||||
- group: CI
|
||||
|
||||
jobs:
|
||||
- job: TestLinux
|
||||
pool:
|
||||
@@ -38,12 +41,28 @@ jobs:
|
||||
- template: .azure-pipelines/steps/run-tests.yml
|
||||
parameters:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
- template: .azure-pipelines/steps/run-vendor-scripts.yml
|
||||
parameters:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
- template: .azure-pipelines/steps/build-package.yml
|
||||
parameters:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
|
||||
- job: TestVendoring
|
||||
pool:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
variables:
|
||||
python.version: '3.7.2'
|
||||
python.architecture: x64
|
||||
steps:
|
||||
- template: .azure-pipelines/steps/run-vendor-scripts.yml
|
||||
parameters:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
|
||||
- job: TestPackaging
|
||||
pool:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
variables:
|
||||
python.version: '3.7.2'
|
||||
python.architecture: x64
|
||||
steps:
|
||||
- template: .azure-pipelines/steps/build-package.yml
|
||||
parameters:
|
||||
vmImage: 'Ubuntu-16.04'
|
||||
|
||||
- job: TestWindows
|
||||
pool:
|
||||
|
||||
@@ -128,10 +128,15 @@ Three ways of running the tests are as follows:
|
||||
|
||||
1. ``make test`` (which uses ``docker``)
|
||||
2. ``./run-tests.sh`` or ``run-tests.bat``
|
||||
3. Using pipenv::
|
||||
3. Using pipenv:
|
||||
|
||||
pipenv install --dev
|
||||
pipenv run pytest
|
||||
.. code-block:: console
|
||||
|
||||
$ git clone https://github.com/pypa/pipenv.git
|
||||
$ cd pipenv
|
||||
$ git submodule sync && git submodule update --init --recursive
|
||||
$ pipenv install --dev
|
||||
$ pipenv run pytest
|
||||
|
||||
For the last two, it is important that your environment is setup correctly, and
|
||||
this may take some work, for example, on a specific Mac installation, the following
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
Fix ``sync --sequential`` ignoring ``pip install`` errors and logs.
|
||||
@@ -0,0 +1,3 @@
|
||||
Allow overriding PIP_EXISTS_ACTION evironment variable (value is passed to pip install).
|
||||
Possible values here: https://pip.pypa.io/en/stable/reference/pip/#exists-action-option
|
||||
Useful when you need to `PIP_EXISTS_ACTION=i` (ignore existing packages) - great for CI environments, where you need really fast setup.
|
||||
@@ -312,7 +312,10 @@ def lock(
|
||||
from ..core import ensure_project, do_init, do_lock
|
||||
|
||||
# Ensure that virtualenv is available.
|
||||
ensure_project(three=state.three, python=state.python, pypi_mirror=state.pypi_mirror)
|
||||
ensure_project(
|
||||
three=state.three, python=state.python, pypi_mirror=state.pypi_mirror,
|
||||
warn=(not state.quiet)
|
||||
)
|
||||
if state.installstate.requirementstxt:
|
||||
do_init(
|
||||
dev=state.installstate.dev,
|
||||
@@ -326,6 +329,7 @@ def lock(
|
||||
pre=state.installstate.pre,
|
||||
keep_outdated=state.installstate.keep_outdated,
|
||||
pypi_mirror=state.pypi_mirror,
|
||||
write=not state.quiet,
|
||||
)
|
||||
|
||||
|
||||
|
||||
+31
-4
@@ -6,7 +6,7 @@ import os
|
||||
import click.types
|
||||
|
||||
from click import (
|
||||
BadParameter, Group, Option, argument, echo, make_pass_decorator, option
|
||||
BadParameter, BadArgumentUsage, Group, Option, argument, echo, make_pass_decorator, option
|
||||
)
|
||||
from click_didyoumean import DYMMixin
|
||||
|
||||
@@ -56,6 +56,7 @@ class State(object):
|
||||
self.index = None
|
||||
self.extra_index_urls = []
|
||||
self.verbose = False
|
||||
self.quiet = False
|
||||
self.pypi_mirror = None
|
||||
self.python = None
|
||||
self.two = None
|
||||
@@ -231,12 +232,32 @@ def verbose_option(f):
|
||||
def callback(ctx, param, value):
|
||||
state = ctx.ensure_object(State)
|
||||
if value:
|
||||
if state.quiet:
|
||||
raise BadArgumentUsage(
|
||||
"--verbose and --quiet are mutually exclusive! Please choose one!",
|
||||
ctx=ctx
|
||||
)
|
||||
state.verbose = True
|
||||
setup_verbosity(ctx, param, value)
|
||||
setup_verbosity(ctx, param, 1)
|
||||
return option("--verbose", "-v", is_flag=True, expose_value=False,
|
||||
callback=callback, help="Verbose mode.", type=click.types.BOOL)(f)
|
||||
|
||||
|
||||
def quiet_option(f):
|
||||
def callback(ctx, param, value):
|
||||
state = ctx.ensure_object(State)
|
||||
if value:
|
||||
if state.verbose:
|
||||
raise BadArgumentUsage(
|
||||
"--verbose and --quiet are mutually exclusive! Please choose one!",
|
||||
ctx=ctx
|
||||
)
|
||||
state.quiet = True
|
||||
setup_verbosity(ctx, param, -1)
|
||||
return option("--quiet", "-q", is_flag=True, expose_value=False,
|
||||
callback=callback, help="Quiet mode.", type=click.types.BOOL)(f)
|
||||
|
||||
|
||||
def site_packages_option(f):
|
||||
def callback(ctx, param, value):
|
||||
state = ctx.ensure_object(State)
|
||||
@@ -313,8 +334,14 @@ def setup_verbosity(ctx, param, value):
|
||||
if not value:
|
||||
return
|
||||
import logging
|
||||
logging.getLogger("pip").setLevel(logging.INFO)
|
||||
environments.PIPENV_VERBOSITY = 1
|
||||
loggers = ("pip", "piptools")
|
||||
if value == 1:
|
||||
for logger in loggers:
|
||||
logging.getLogger(logger).setLevel(logging.INFO)
|
||||
elif value == -1:
|
||||
for logger in loggers:
|
||||
logging.getLogger(logger).setLevel(logging.CRITICAL)
|
||||
environments.PIPENV_VERBOSITY = value
|
||||
|
||||
|
||||
def validate_python_path(ctx, param, value):
|
||||
|
||||
+38
-33
@@ -26,7 +26,7 @@ from .environments import (
|
||||
PIPENV_CACHE_DIR, PIPENV_COLORBLIND, PIPENV_DEFAULT_PYTHON_VERSION,
|
||||
PIPENV_DONT_USE_PYENV, PIPENV_HIDE_EMOJIS, PIPENV_MAX_SUBPROCESS,
|
||||
PIPENV_PYUP_API_KEY, PIPENV_SHELL_FANCY, PIPENV_SKIP_VALIDATION,
|
||||
PIPENV_YES, SESSION_IS_INTERACTIVE
|
||||
PIPENV_YES, SESSION_IS_INTERACTIVE, PIP_EXISTS_ACTION
|
||||
)
|
||||
from .project import Project, SourceNotFound
|
||||
from .utils import (
|
||||
@@ -35,7 +35,7 @@ from .utils import (
|
||||
get_canonical_names, is_pinned, is_pypi_url, is_required_version, is_star,
|
||||
is_valid_url, parse_indexes, pep423_name, prepare_pip_source_args,
|
||||
proper_case, python_version, venv_resolve_deps, run_command,
|
||||
is_python_command, find_python
|
||||
is_python_command, find_python, make_posix, interrupt_handled_subprocess
|
||||
)
|
||||
|
||||
|
||||
@@ -371,6 +371,9 @@ def ensure_python(three=None, python=None):
|
||||
if not python:
|
||||
python = PIPENV_DEFAULT_PYTHON_VERSION
|
||||
path_to_python = find_a_system_python(python)
|
||||
if environments.is_verbose():
|
||||
click.echo(u"Using python: {0}".format(python), err=True)
|
||||
click.echo(u"Path to python: {0}".format(path_to_python), err=True)
|
||||
if not path_to_python and python is not None:
|
||||
# We need to install Python.
|
||||
click.echo(
|
||||
@@ -642,10 +645,10 @@ def do_where(virtualenv=False, bare=True):
|
||||
click.echo(location)
|
||||
|
||||
|
||||
def _cleanup_procs(procs, concurrent, failed_deps_queue, retry=True):
|
||||
def _cleanup_procs(procs, failed_deps_queue, retry=True):
|
||||
while not procs.empty():
|
||||
c = procs.get()
|
||||
if concurrent:
|
||||
if not c.blocking:
|
||||
c.block()
|
||||
failed = False
|
||||
if c.return_code != 0:
|
||||
@@ -679,7 +682,7 @@ def _cleanup_procs(procs, concurrent, failed_deps_queue, retry=True):
|
||||
def batch_install(deps_list, procs, failed_deps_queue,
|
||||
requirements_dir, no_deps=False, ignore_hashes=False,
|
||||
allow_global=False, blocking=False, pypi_mirror=None,
|
||||
nprocs=PIPENV_MAX_SUBPROCESS, retry=True):
|
||||
retry=True):
|
||||
from .vendor.requirementslib.models.utils import strip_extras_markers_from_requirement
|
||||
failed = (not retry)
|
||||
if not failed:
|
||||
@@ -750,12 +753,13 @@ def batch_install(deps_list, procs, failed_deps_queue,
|
||||
extra_indexes=extra_indexes,
|
||||
use_pep517=not failed,
|
||||
)
|
||||
if procs.qsize() < nprocs:
|
||||
c.dep = dep
|
||||
procs.put(c)
|
||||
c.dep = dep
|
||||
if dep.is_vcs or dep.editable:
|
||||
c.block()
|
||||
|
||||
procs.put(c)
|
||||
if procs.full() or procs.qsize() == len(deps_list):
|
||||
_cleanup_procs(procs, not blocking, failed_deps_queue, retry=retry)
|
||||
_cleanup_procs(procs, failed_deps_queue, retry=retry)
|
||||
|
||||
|
||||
def do_install_dependencies(
|
||||
@@ -779,7 +783,6 @@ def do_install_dependencies(
|
||||
from six.moves import queue
|
||||
if requirements:
|
||||
bare = True
|
||||
blocking = not concurrent
|
||||
# Load the lockfile if it exists, or if only is being used (e.g. lock is being used).
|
||||
if skip_lock or only or not project.lockfile_exists:
|
||||
if not bare:
|
||||
@@ -815,19 +818,19 @@ def do_install_dependencies(
|
||||
)
|
||||
sys.exit(0)
|
||||
|
||||
procs = queue.Queue(maxsize=PIPENV_MAX_SUBPROCESS)
|
||||
if concurrent:
|
||||
nprocs = PIPENV_MAX_SUBPROCESS
|
||||
else:
|
||||
nprocs = 1
|
||||
procs = queue.Queue(maxsize=nprocs)
|
||||
failed_deps_queue = queue.Queue()
|
||||
if skip_lock:
|
||||
ignore_hashes = True
|
||||
|
||||
install_kwargs = {
|
||||
"no_deps": no_deps, "ignore_hashes": ignore_hashes, "allow_global": allow_global,
|
||||
"blocking": blocking, "pypi_mirror": pypi_mirror
|
||||
"blocking": not concurrent, "pypi_mirror": pypi_mirror
|
||||
}
|
||||
if concurrent:
|
||||
install_kwargs["nprocs"] = PIPENV_MAX_SUBPROCESS
|
||||
else:
|
||||
install_kwargs["nprocs"] = 1
|
||||
|
||||
# with project.environment.activated():
|
||||
batch_install(
|
||||
@@ -835,7 +838,7 @@ def do_install_dependencies(
|
||||
)
|
||||
|
||||
if not procs.empty():
|
||||
_cleanup_procs(procs, concurrent, failed_deps_queue)
|
||||
_cleanup_procs(procs, failed_deps_queue)
|
||||
|
||||
# Iterate over the hopefully-poorly-packaged dependencies…
|
||||
if not failed_deps_queue.empty():
|
||||
@@ -847,7 +850,6 @@ def do_install_dependencies(
|
||||
failed_dep = failed_deps_queue.get()
|
||||
retry_list.append(failed_dep)
|
||||
install_kwargs.update({
|
||||
"nprocs": 1,
|
||||
"retry": False,
|
||||
"blocking": True,
|
||||
})
|
||||
@@ -855,7 +857,7 @@ def do_install_dependencies(
|
||||
retry_list, procs, failed_deps_queue, requirements_dir, **install_kwargs
|
||||
)
|
||||
if not procs.empty():
|
||||
_cleanup_procs(procs, False, failed_deps_queue, retry=False)
|
||||
_cleanup_procs(procs, failed_deps_queue, retry=False)
|
||||
|
||||
|
||||
def convert_three_to_python(three, python):
|
||||
@@ -885,11 +887,13 @@ def do_create_virtualenv(python=None, site_packages=False, pypi_mirror=None):
|
||||
)
|
||||
|
||||
# Default to using sys.executable, if Python wasn't provided.
|
||||
using_string = u"Using"
|
||||
if not python:
|
||||
python = sys.executable
|
||||
using_string = "Using default python from"
|
||||
click.echo(
|
||||
u"{0} {1} {3} {2}".format(
|
||||
crayons.normal("Using", bold=True),
|
||||
crayons.normal(using_string, bold=True),
|
||||
crayons.red(python, bold=True),
|
||||
crayons.normal(fix_utf8("to create virtualenv…"), bold=True),
|
||||
crayons.green("({0})".format(python_version(python))),
|
||||
@@ -919,20 +923,19 @@ def do_create_virtualenv(python=None, site_packages=False, pypi_mirror=None):
|
||||
pip_config = {}
|
||||
|
||||
# Actually create the virtualenv.
|
||||
error = None
|
||||
with create_spinner(u"Creating virtual environment...") as sp:
|
||||
c = vistir.misc.run(
|
||||
cmd, verbose=False, return_object=True, write_to_stdout=False,
|
||||
combine_stderr=False, block=True, nospin=True, env=pip_config,
|
||||
with interrupt_handled_subprocess(cmd, combine_stderr=False, env=pip_config) as c:
|
||||
click.echo(crayons.blue(u"{0}".format(c.out)), err=True)
|
||||
if c.returncode != 0:
|
||||
error = c.err if environments.is_verbose() else exceptions.prettify_exc(c.err)
|
||||
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format(u"Failed creating virtual environment"))
|
||||
else:
|
||||
sp.green.ok(environments.PIPENV_SPINNER_OK_TEXT.format(u"Successfully created virtual environment!"))
|
||||
if error is not None:
|
||||
raise exceptions.VirtualenvCreationException(
|
||||
extra=crayons.red("{0}".format(error))
|
||||
)
|
||||
click.echo(crayons.blue(u"{0}".format(c.out)), err=True)
|
||||
if c.returncode != 0:
|
||||
sp.fail(environments.PIPENV_SPINNER_FAIL_TEXT.format(u"Failed creating virtual environment"))
|
||||
error = c.err if environments.is_verbose() else exceptions.prettify_exc(c.err)
|
||||
raise exceptions.VirtualenvCreationException(
|
||||
extra=crayons.red("{0}".format(error))
|
||||
)
|
||||
else:
|
||||
sp.green.ok(environments.PIPENV_SPINNER_OK_TEXT.format(u"Successfully created virtual environment!"))
|
||||
|
||||
# Associate project directory with the environment.
|
||||
# This mimics Pew's "setproject".
|
||||
@@ -1509,7 +1512,7 @@ def pip_install(
|
||||
"PIP_DESTINATION_DIR": vistir.misc.fs_str(
|
||||
cache_dir.joinpath("pkgs").as_posix()
|
||||
),
|
||||
"PIP_EXISTS_ACTION": vistir.misc.fs_str("w"),
|
||||
"PIP_EXISTS_ACTION": vistir.misc.fs_str(PIP_EXISTS_ACTION or "w"),
|
||||
"PATH": vistir.misc.fs_str(os.environ.get("PATH")),
|
||||
}
|
||||
if src:
|
||||
@@ -2503,6 +2506,8 @@ def do_run(command, args, three=None, python=False, pypi_mirror=None):
|
||||
previous_pipenv_active_value = os.environ.get("PIPENV_ACTIVE")
|
||||
os.environ["PIPENV_ACTIVE"] = vistir.misc.fs_str("1")
|
||||
|
||||
os.environ.pop("PIP_SHIMS_BASE_MODULE", None)
|
||||
|
||||
try:
|
||||
script = project.build_script(command, args)
|
||||
cmd_string = ' '.join([script.command] + script.args)
|
||||
|
||||
@@ -126,7 +126,7 @@ PIPENV_MAX_ROUNDS = int(os.environ.get("PIPENV_MAX_ROUNDS", "16"))
|
||||
Default is 16, an arbitrary number that works most of the time.
|
||||
"""
|
||||
|
||||
PIPENV_MAX_SUBPROCESS = int(os.environ.get("PIPENV_MAX_SUBPROCESS", "16"))
|
||||
PIPENV_MAX_SUBPROCESS = int(os.environ.get("PIPENV_MAX_SUBPROCESS", "8"))
|
||||
"""How many subprocesses should Pipenv use when installing.
|
||||
|
||||
Default is 16, an arbitrary number that seems to work.
|
||||
@@ -150,14 +150,12 @@ environments.
|
||||
if PIPENV_IS_CI:
|
||||
PIPENV_NOSPIN = True
|
||||
|
||||
PIPENV_SPINNER = "dots"
|
||||
PIPENV_SPINNER = "dots" if not os.name == "nt" else "bouncingBar"
|
||||
"""Sets the default spinner type.
|
||||
|
||||
Spinners are identitcal to the node.js spinners and can be found at
|
||||
https://github.com/sindresorhus/cli-spinners
|
||||
"""
|
||||
if os.name == "nt":
|
||||
PIPENV_SPINNER = "bouncingBar"
|
||||
|
||||
PIPENV_PIPFILE = os.environ.get("PIPENV_PIPFILE")
|
||||
"""If set, this specifies a custom Pipfile location.
|
||||
@@ -236,6 +234,12 @@ Default is to lock dependencies and update ``Pipfile.lock`` on each run.
|
||||
NOTE: This only affects the ``install`` and ``uninstall`` commands.
|
||||
"""
|
||||
|
||||
PIP_EXISTS_ACTION = os.environ.get("PIP_EXISTS_ACTION", "w")
|
||||
"""Specifies the value for pip's --exists-action option
|
||||
|
||||
Defaullts to (w)ipe
|
||||
"""
|
||||
|
||||
PIPENV_RESOLVE_VCS = _is_env_truthy(os.environ.get("PIPENV_RESOLVE_VCS", 'true'))
|
||||
"""Tells Pipenv whether to resolve all VCS dependencies in full.
|
||||
|
||||
@@ -244,7 +248,6 @@ To retain this behavior and avoid handling any conflicts that arise from the new
|
||||
approach, you may set this to '0', 'off', or 'false'.
|
||||
"""
|
||||
|
||||
|
||||
PIPENV_PYUP_API_KEY = os.environ.get(
|
||||
"PIPENV_PYUP_API_KEY", "1ab8d58f-5122e025-83674263-bc1e79e0"
|
||||
)
|
||||
|
||||
+42
-4
@@ -6,6 +6,7 @@ import logging
|
||||
import os
|
||||
import posixpath
|
||||
import re
|
||||
import signal
|
||||
import shutil
|
||||
import stat
|
||||
import sys
|
||||
@@ -25,7 +26,7 @@ six.add_move(six.MovedAttribute("Set", "collections", "collections.abc")) # noq
|
||||
from six.moves import Mapping, Sequence, Set
|
||||
from six.moves.urllib.parse import urlparse
|
||||
from .vendor.vistir.compat import ResourceWarning, lru_cache
|
||||
from .vendor.vistir.misc import fs_str
|
||||
from .vendor.vistir.misc import fs_str, run
|
||||
|
||||
import crayons
|
||||
import parse
|
||||
@@ -964,9 +965,9 @@ def create_spinner(text, nospin=None, spinner_name=None):
|
||||
if nospin is None:
|
||||
nospin = environments.PIPENV_NOSPIN
|
||||
with spin.create_spinner(
|
||||
spinner_name=spinner_name,
|
||||
start_text=fs_str(text),
|
||||
nospin=nospin, write_to_stdout=False
|
||||
spinner_name=spinner_name,
|
||||
start_text=fs_str(text),
|
||||
nospin=nospin, write_to_stdout=False
|
||||
) as sp:
|
||||
yield sp
|
||||
|
||||
@@ -2103,3 +2104,40 @@ def make_marker_from_specifier(spec):
|
||||
specset = cleanup_pyspecs(SpecifierSet(spec))
|
||||
marker_str = " and ".join([format_pyversion(pv) for pv in specset])
|
||||
return Marker(marker_str)
|
||||
|
||||
|
||||
@contextlib.contextmanager
|
||||
def interrupt_handled_subprocess(
|
||||
cmd, verbose=False, return_object=True, write_to_stdout=False, combine_stderr=True,
|
||||
block=True, nospin=True, env=None
|
||||
):
|
||||
"""Given a :class:`subprocess.Popen` instance, wrap it in exception handlers.
|
||||
|
||||
Terminates the subprocess when and if a `SystemExit` or `KeyboardInterrupt` are
|
||||
processed.
|
||||
|
||||
Arguments:
|
||||
:param str cmd: A command to run
|
||||
:param bool verbose: Whether to run with verbose mode enabled, default False
|
||||
:param bool return_object: Whether to return a subprocess instance or a 2-tuple, default True
|
||||
:param bool write_to_stdout: Whether to write directly to stdout, default False
|
||||
:param bool combine_stderr: Whether to combine stdout and stderr, default True
|
||||
:param bool block: Whether the subprocess should be a blocking subprocess, default True
|
||||
:param bool nospin: Whether to suppress the spinner with the subprocess, default True
|
||||
:param Optional[Dict[str, str]] env: A dictionary to merge into the subprocess environment
|
||||
:return: A subprocess, wrapped in exception handlers, as a context manager
|
||||
:rtype: :class:`subprocess.Popen` obj: An instance of a running subprocess
|
||||
"""
|
||||
obj = run(
|
||||
cmd, verbose=verbose, return_object=True, write_to_stdout=False,
|
||||
combine_stderr=False, block=True, nospin=True, env=env,
|
||||
)
|
||||
try:
|
||||
yield obj
|
||||
except (SystemExit, KeyboardInterrupt):
|
||||
if os.name == "nt":
|
||||
os.kill(obj.pid, signal.CTRL_BREAK_EVENT)
|
||||
else:
|
||||
os.kill(obj.pid, signal.SIGINT)
|
||||
obj.wait()
|
||||
raise
|
||||
|
||||
Vendored
+1
-1
@@ -62,7 +62,7 @@ KNOWN_EXTS = {"exe", "py", "fish", "sh", ""}
|
||||
KNOWN_EXTS = KNOWN_EXTS | set(
|
||||
filter(None, os.environ.get("PATHEXT", "").split(os.pathsep))
|
||||
)
|
||||
PY_MATCH_STR = r"((?P<implementation>{0})(?:\d?(?:\.\d[cpm]{{0,3}}))?(?:-?[\d\.]+)*[^z])".format(
|
||||
PY_MATCH_STR = r"((?P<implementation>{0})(?:\d?(?:\.\d[cpm]{{0,3}}))?(?:-?[\d\.]+)*[^zw])".format(
|
||||
"|".join(PYTHON_IMPLEMENTATIONS)
|
||||
)
|
||||
EXE_MATCH_STR = r"{0}(?:\.(?P<ext>{1}))?".format(PY_MATCH_STR, "|".join(KNOWN_EXTS))
|
||||
|
||||
Vendored
+3
-1
@@ -6,6 +6,7 @@ import json
|
||||
import locale
|
||||
import logging
|
||||
import os
|
||||
import signal
|
||||
import subprocess
|
||||
import sys
|
||||
from collections import OrderedDict
|
||||
@@ -303,9 +304,10 @@ def _create_subprocess(
|
||||
else:
|
||||
try:
|
||||
c.out, c.err = c.communicate()
|
||||
except (SystemExit, TimeoutError):
|
||||
except (SystemExit, KeyboardInterrupt, TimeoutError):
|
||||
c.terminate()
|
||||
c.out, c.err = c.communicate()
|
||||
raise
|
||||
if not block:
|
||||
c.wait()
|
||||
c.out = to_text("{0}".format(c.out)) if c.out else fs_str("")
|
||||
|
||||
Vendored
-2
@@ -41,7 +41,6 @@ if os.name == "nt": # pragma: no cover
|
||||
"""
|
||||
spinner.fail()
|
||||
spinner.stop()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
else: # pragma: no cover
|
||||
@@ -55,7 +54,6 @@ else: # pragma: no cover
|
||||
"""
|
||||
spinner.red.fail("✘")
|
||||
spinner.stop()
|
||||
sys.exit(0)
|
||||
|
||||
|
||||
CLEAR_LINE = chr(27) + "[K"
|
||||
|
||||
+11
-3
@@ -1,7 +1,15 @@
|
||||
rem imdisk -a -s 964515b -m R: -p "/FS:NTFS /Y"
|
||||
rem If you want to use a ramdisk, use this section:
|
||||
|
||||
rem imdisk -a -s 4G -m R: -p "FS:NTFS /y"
|
||||
rem if you are using a ram disk, you should comment the following substitution line out
|
||||
subst R: %TEMP%
|
||||
|
||||
set TMP=R:\\
|
||||
set TEMP=R:\\
|
||||
set WORKON_HOME=R:\\
|
||||
set RAM_DISK=R:\\
|
||||
|
||||
virtualenv R:\.venv
|
||||
R:\.venv\Scripts\pip install -e .[test] --upgrade --upgrade-strategy=only-if-needed
|
||||
R:\.venv\Scripts\pipenv install --dev
|
||||
git submodule sync && git submodule update --init --recursive
|
||||
SET RAM_DISK=R: && R:\.venv\Scripts\pipenv run pytest -n auto -v tests --tap-stream > report.tap
|
||||
R:\.venv\Scripts\pipenv run pytest -n auto -v tests
|
||||
|
||||
+16
-36
@@ -7,6 +7,8 @@ set -eo pipefail
|
||||
export PYTHONIOENCODING="utf-8"
|
||||
export LANG=C.UTF-8
|
||||
export PIP_PROCESS_DEPENDENCY_LINKS="1"
|
||||
# Let's use a temporary cache directory
|
||||
export PIPENV_CACHE_DIR=`mktemp -d 2>/dev/null || mktemp -d -t 'pipenv_cache'`
|
||||
|
||||
prefix() {
|
||||
sed "s/^/ $1: /"
|
||||
@@ -25,49 +27,27 @@ fi
|
||||
if [[ ! -z "$HOME" ]]; then
|
||||
export PATH="${HOME}/.local/bin:${PATH}"
|
||||
fi
|
||||
# pip uninstall -y pipenv
|
||||
pip install certifi
|
||||
export GIT_SSL_CAINFO=$(python -m certifi)
|
||||
echo "Path: $PATH"
|
||||
echo "Installing Pipenv…"
|
||||
PIP_USER="1" python -m pip install --upgrade setuptools
|
||||
PIP_USER="1" python3 -m pip install --upgrade setuptools
|
||||
python -m pip install -e "$(pwd)" --upgrade && python3 -m pip install -e "$(pwd)" --upgrade
|
||||
python3 -m pipenv install --deploy --dev --system
|
||||
|
||||
# Otherwise, we're on a development machine.
|
||||
# First, try MacOS…
|
||||
if [[ $(python -c "import sys; print(sys.platform)") == "darwin" ]]; then
|
||||
|
||||
echo "Clearing Caches…"
|
||||
rm -fr ~/Library/Caches/pip
|
||||
rm -fr ~/Library/Caches/pipenv
|
||||
|
||||
# Otherwise, assume Linux…
|
||||
else
|
||||
echo "Clearing Caches…"
|
||||
rm -fr ~/.cache/pip
|
||||
rm -fr ~/.cache/pipenv
|
||||
fi
|
||||
python -m pip install --upgrade -e "$(pwd)" setuptools wheel pip
|
||||
VENV_CMD="python -m pipenv --venv"
|
||||
RM_CMD="pipenv --rm"
|
||||
echo "$ PIPENV_PYTHON=2.7 $VENV_CMD && PIPENV_PYTHON=2.7 $RM_CMD"
|
||||
echo "$ PIPENV_PYTHON=3.7 $VENV_CMD && PIPENV_PYTHON=3.7 $RM_CMD"
|
||||
{ PIPENV_PYTHON=2.7 $VENV_CMD && PIPENV_PYTHON=2.7 $RM_CMD ; PIPENV_PYTHON=3.7 $VENV_CMD && PIPENV_PYTHON=3.7 $RM_CMD ; }
|
||||
|
||||
echo "Installing dependencies…"
|
||||
PIPENV_PYTHON=2.7 python3 -m pipenv --venv && pipenv --rm && pipenv install --dev
|
||||
PIPENV_PYTHON=3.7 python3 -m pipenv --venv && pipenv --rm && pipenv install --dev
|
||||
PIPENV_PYTHON=2.7 python3 -m pipenv run pip install --upgrade -e .[test]
|
||||
PIPENV_PYTHON=3.7 python3 -m pipenv run pip install --upgrade -e .[test]
|
||||
INSTALL_CMD="python -m pipenv install --deploy --dev"
|
||||
echo "$ PIPENV_PYTHON=2.7 $INSTALL_CMD"
|
||||
echo "$ PIPENV_PYTHON=3.7 $INSTALL_CMD"
|
||||
|
||||
{ ( PIPENV_PYTHON=2.7 $INSTALL_CMD & ); PIPENV_PYTHON=3.7 $INSTALL_CMD ; }
|
||||
echo "$ git submodule sync && git submodule update --init --recursive"
|
||||
|
||||
git submodule sync && git submodule update --init --recursive
|
||||
|
||||
echo "$ pipenv run time pytest -v -n auto tests -m \"$TEST_SUITE\""
|
||||
# PIPENV_PYTHON=2.7 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" | prefix 2.7 &
|
||||
# PIPENV_PYTHON=3.6 pipenv run time pytest -v -n auto tests -m "$TEST_SUITE" | prefix 3.6
|
||||
# Better to run them sequentially.
|
||||
PIPENV_PYTHON=2.7 python3 -m pipenv run time pytest
|
||||
PIPENV_PYTHON=3.7 python3 -m pipenv run time pytest
|
||||
|
||||
# test revendoring
|
||||
pip3 install --upgrade invoke requests parver vistir
|
||||
python3 -m invoke vendoring.update
|
||||
# Cleanup junk.
|
||||
rm -fr .venv
|
||||
echo "$ pipenv run time pytest"
|
||||
PIPENV_PYTHON=2.7 python -m pipenv run time pytest
|
||||
PIPENV_PYTHON=3.7 python -m pipenv run time pytest
|
||||
|
||||
@@ -17,6 +17,7 @@ from vistir.contextmanagers import temp_environ
|
||||
from vistir.path import mkdir_p, create_tracked_tempdir, handle_remove_readonly
|
||||
|
||||
from pipenv._compat import Path
|
||||
from pipenv.cmdparse import Script
|
||||
from pipenv.exceptions import VirtualenvActivationException
|
||||
from pipenv.vendor import delegator, requests, toml, tomlkit
|
||||
from pytest_pypi.app import prepare_fixtures
|
||||
@@ -111,6 +112,8 @@ def pytest_runtest_setup(item):
|
||||
sys.version_info < (3, 0)
|
||||
):
|
||||
pytest.skip('test only runs on python 3')
|
||||
if item.get_closest_marker('skip_osx') is not None and sys.platform == 'darwin':
|
||||
pytest.skip('test does not apply on OSX')
|
||||
if item.get_closest_marker('lte_py36') is not None and (
|
||||
sys.version_info >= (3, 7)
|
||||
):
|
||||
@@ -329,8 +332,10 @@ class _PipenvInstance(object):
|
||||
|
||||
with TemporaryDirectory(prefix='pipenv-', suffix='-cache') as tempdir:
|
||||
os.environ['PIPENV_CACHE_DIR'] = fs_str(tempdir.name)
|
||||
c = delegator.run('pipenv {0}'.format(cmd), block=block,
|
||||
cwd=os.path.abspath(self.path))
|
||||
c = delegator.run(
|
||||
'pipenv {0}'.format(cmd), block=block,
|
||||
cwd=os.path.abspath(self.path), env=os.environ.copy()
|
||||
)
|
||||
if 'PIPENV_CACHE_DIR' in os.environ:
|
||||
del os.environ['PIPENV_CACHE_DIR']
|
||||
|
||||
|
||||
@@ -217,6 +217,7 @@ def test_install_parse_error(PipenvInstance, pypi):
|
||||
@pytest.mark.code
|
||||
@pytest.mark.check
|
||||
@pytest.mark.unused
|
||||
@pytest.mark.skip_osx
|
||||
@pytest.mark.needs_internet(reason='required by check')
|
||||
def test_check_unused(PipenvInstance, pypi):
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
|
||||
@@ -70,12 +70,12 @@ def test_venv_file(venv_name, PipenvInstance, pypi):
|
||||
venv_loc = Path(c.out.strip()).absolute()
|
||||
assert venv_loc.exists()
|
||||
assert venv_loc.joinpath('.project').exists()
|
||||
venv_path = venv_loc.as_posix()
|
||||
venv_path = normalize_drive(venv_loc.as_posix())
|
||||
if os.path.sep in venv_name:
|
||||
venv_expected_path = Path(p.path).joinpath(venv_name).absolute().as_posix()
|
||||
else:
|
||||
venv_expected_path = Path(workon_home.name).joinpath(venv_name).absolute().as_posix()
|
||||
assert venv_path == venv_expected_path
|
||||
assert venv_path == normalize_drive(venv_expected_path)
|
||||
|
||||
|
||||
@pytest.mark.dotvenv
|
||||
|
||||
@@ -28,8 +28,9 @@ def test_basic_setup(PipenvInstance, pypi):
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
@pytest.mark.install
|
||||
@pytest.mark.skip_osx
|
||||
def test_basic_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv("install requests")
|
||||
@@ -42,8 +43,8 @@ def test_basic_install(PipenvInstance, pypi):
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
@pytest.mark.install
|
||||
def test_mirror_install(PipenvInstance, pypi):
|
||||
with temp_environ(), PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
mirror_url = os.environ.pop(
|
||||
@@ -68,9 +69,9 @@ def test_mirror_install(PipenvInstance, pypi):
|
||||
assert "certifi" in p.lockfile["default"]
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.install
|
||||
@pytest.mark.needs_internet
|
||||
@flaky
|
||||
def test_bad_mirror_install(PipenvInstance, pypi):
|
||||
with temp_environ(), PipenvInstance(chdir=True) as p:
|
||||
# This demonstrates that the mirror parameter is being used
|
||||
@@ -79,8 +80,8 @@ def test_bad_mirror_install(PipenvInstance, pypi):
|
||||
assert c.return_code != 0
|
||||
|
||||
|
||||
@pytest.mark.complex
|
||||
@pytest.mark.lock
|
||||
@pytest.mark.complex
|
||||
@pytest.mark.skip(reason="Does not work unless you can explicitly install into py2")
|
||||
def test_complex_lock(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
@@ -91,9 +92,9 @@ def test_complex_lock(PipenvInstance, pypi):
|
||||
assert "futures" in p.lockfile[u"default"]
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.dev
|
||||
@pytest.mark.run
|
||||
@flaky
|
||||
def test_basic_dev_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
c = p.pipenv("install requests --dev")
|
||||
@@ -109,9 +110,9 @@ def test_basic_dev_install(PipenvInstance, pypi):
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.dev
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
def test_install_without_dev(PipenvInstance, pypi):
|
||||
"""Ensure that running `pipenv install` doesn't install dev packages"""
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
@@ -136,8 +137,8 @@ pytz = "*"
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
@pytest.mark.install
|
||||
def test_install_without_dev_section(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
@@ -156,9 +157,9 @@ six = "*"
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.extras
|
||||
@pytest.mark.install
|
||||
@flaky
|
||||
def test_extras_install(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
c = p.pipenv("install requests[socks]")
|
||||
@@ -173,9 +174,9 @@ def test_extras_install(PipenvInstance, pypi):
|
||||
assert "pysocks" in p.lockfile["default"]
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@pytest.mark.pin
|
||||
@flaky
|
||||
@pytest.mark.pin
|
||||
@pytest.mark.install
|
||||
def test_windows_pinned_pipfile(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
@@ -190,10 +191,10 @@ requests = "==2.19.1"
|
||||
assert "requests" in p.lockfile["default"]
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.install
|
||||
@pytest.mark.resolver
|
||||
@pytest.mark.backup_resolver
|
||||
@flaky
|
||||
def test_backup_resolver(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
@@ -208,9 +209,9 @@ def test_backup_resolver(PipenvInstance, pypi):
|
||||
assert "ibm-db-sa-py3" in p.lockfile["default"]
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.run
|
||||
@pytest.mark.alt
|
||||
@flaky
|
||||
def test_alternative_version_specifier(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
@@ -233,9 +234,9 @@ requests = {version = "*"}
|
||||
assert c.return_code == 0
|
||||
|
||||
|
||||
@flaky
|
||||
@pytest.mark.run
|
||||
@pytest.mark.alt
|
||||
@flaky
|
||||
def test_outline_table_specifier(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, "w") as f:
|
||||
@@ -297,6 +298,7 @@ def test_requirements_to_pipfile(PipenvInstance, pypi):
|
||||
|
||||
|
||||
@pytest.mark.install
|
||||
@pytest.mark.skip_osx
|
||||
@pytest.mark.requirements
|
||||
def test_skip_requirements_when_pipfile(PipenvInstance, pypi):
|
||||
"""Ensure requirements.txt is NOT imported when
|
||||
|
||||
@@ -140,7 +140,7 @@ def test_resolver_unique_markers(PipenvInstance, pypi):
|
||||
This verifies that we clean that successfully.
|
||||
"""
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
c = p.pipenv('install vcrpy==1.11.0')
|
||||
c = p.pipenv('install vcrpy==2.0.1')
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('lock')
|
||||
assert c.return_code == 0
|
||||
@@ -148,7 +148,7 @@ def test_resolver_unique_markers(PipenvInstance, pypi):
|
||||
yarl = p.lockfile['default']['yarl']
|
||||
assert 'markers' in yarl
|
||||
# Two possible marker sets are ok here
|
||||
assert yarl['markers'] in ["python_version in '3.4, 3.5, 3.6'", "python_version >= '3.4.1'"]
|
||||
assert yarl['markers'] in ["python_version in '3.4, 3.5, 3.6'", "python_version >= '3.4'"]
|
||||
|
||||
|
||||
@pytest.mark.project
|
||||
|
||||
@@ -128,17 +128,17 @@ def test_keep_outdated_doesnt_upgrade_pipfile_pins(PipenvInstance, pypi):
|
||||
|
||||
def test_keep_outdated_keeps_markers_not_removed(PipenvInstance, pypi):
|
||||
with PipenvInstance(chdir=True, pypi=pypi) as p:
|
||||
c = p.pipenv("install tablib")
|
||||
c = p.pipenv("install six click")
|
||||
assert c.ok
|
||||
lockfile = Path(p.lockfile_path)
|
||||
lockfile_content = lockfile.read_text()
|
||||
lockfile_json = json.loads(lockfile_content)
|
||||
assert "tablib" in lockfile_json["default"]
|
||||
lockfile_json["default"]["tablib"]["markers"] = "python_version >= '2.7'"
|
||||
assert "six" in lockfile_json["default"]
|
||||
lockfile_json["default"]["six"]["markers"] = "python_version >= '2.7'"
|
||||
lockfile.write_text(to_text(json.dumps(lockfile_json)))
|
||||
c = p.pipenv("lock --keep-outdated")
|
||||
assert c.ok
|
||||
assert p.lockfile["default"]["tablib"].get("markers", "") == "python_version >= '2.7'"
|
||||
assert p.lockfile["default"]["six"].get("markers", "") == "python_version >= '2.7'"
|
||||
|
||||
|
||||
@pytest.mark.lock
|
||||
@@ -596,18 +596,20 @@ def test_lock_no_warnings(PipenvInstance, pypi):
|
||||
@pytest.mark.lock
|
||||
@pytest.mark.install
|
||||
@pytest.mark.skipif(sys.version_info >= (3, 5), reason="scandir doesn't get installed on python 3.5+")
|
||||
def test_lock_missing_cache_entries_gets_all_hashes(monkeypatch, PipenvInstance, pypi, tmpdir):
|
||||
def test_lock_missing_cache_entries_gets_all_hashes(PipenvInstance, pypi, tmpdir):
|
||||
"""
|
||||
Test locking pathlib2 on python2.7 which needs `scandir`, but fails to resolve when
|
||||
using a fresh dependency cache.
|
||||
"""
|
||||
|
||||
with monkeypatch.context() as m:
|
||||
monkeypatch.setattr("pipenv.patched.piptools.locations.CACHE_DIR", tmpdir.strpath)
|
||||
with temp_environ():
|
||||
os.environ["PIPENV_CACHE_DIR"] = str(tmpdir.strpath)
|
||||
with PipenvInstance(pypi=pypi, chdir=True) as p:
|
||||
p._pipfile.add("pathlib2", "*")
|
||||
assert "pathlib2" in p.pipfile["packages"]
|
||||
c = p.pipenv("install")
|
||||
assert c.return_code == 0, (c.err, ("\n".join(["{0}: {1}\n".format(k, v) for k, v in os.environ.items()])))
|
||||
c = p.pipenv("lock --clear")
|
||||
assert c.return_code == 0, c.err
|
||||
assert "pathlib2" in p.lockfile["default"]
|
||||
assert "scandir" in p.lockfile["default"]
|
||||
|
||||
@@ -10,6 +10,7 @@ from pipenv.patched import pipfile
|
||||
from pipenv.project import Project
|
||||
from pipenv.utils import temp_environ
|
||||
from pipenv.vendor.vistir.path import is_in_path
|
||||
from pipenv.vendor.delegator import run as delegator_run
|
||||
import pipenv.environments
|
||||
|
||||
|
||||
@@ -173,22 +174,38 @@ def test_include_editable_packages(PipenvInstance, pypi, testsroot, pathlib_tmpd
|
||||
@pytest.mark.virtualenv
|
||||
def test_run_in_virtualenv_with_global_context(PipenvInstance, pypi, virtualenv):
|
||||
with PipenvInstance(chdir=True, pypi=pypi, venv_root=virtualenv.as_posix(), ignore_virtualenvs=False, venv_in_project=False) as p:
|
||||
c = p.pipenv('run pip freeze')
|
||||
assert c.return_code == 0
|
||||
assert 'Creating a virtualenv' not in c.err
|
||||
c = delegator_run(
|
||||
"pipenv run pip freeze", cwd=os.path.abspath(p.path),
|
||||
env=os.environ.copy()
|
||||
)
|
||||
assert c.return_code == 0, (c.out, c.err)
|
||||
assert 'Creating a virtualenv' not in c.err, c.err
|
||||
project = Project()
|
||||
assert project.virtualenv_location == virtualenv.as_posix()
|
||||
c = p.pipenv("run pip install click")
|
||||
assert c.return_code == 0
|
||||
assert "Courtesy Notice" in c.err
|
||||
c = p.pipenv("install six")
|
||||
assert c.return_code == 0
|
||||
c = p.pipenv('run python -c "import click;print(click.__file__)"')
|
||||
assert c.return_code == 0
|
||||
assert is_in_path(c.out.strip(), str(virtualenv))
|
||||
c = p.pipenv("clean --dry-run")
|
||||
assert c.return_code == 0
|
||||
assert "click" in c.out
|
||||
assert project.virtualenv_location == virtualenv.as_posix(), (
|
||||
project.virtualenv_location, virtualenv.as_posix()
|
||||
)
|
||||
c = delegator_run(
|
||||
"pipenv run pip install click", cwd=os.path.abspath(p.path),
|
||||
env=os.environ.copy()
|
||||
)
|
||||
assert c.return_code == 0, (c.out, c.err)
|
||||
assert "Courtesy Notice" in c.err, (c.out, c.err)
|
||||
c = delegator_run(
|
||||
"pipenv install six", cwd=os.path.abspath(p.path), env=os.environ.copy()
|
||||
)
|
||||
assert c.return_code == 0, (c.out, c.err)
|
||||
c = delegator_run(
|
||||
'pipenv run python -c "import click;print(click.__file__)"',
|
||||
cwd=os.path.abspath(p.path), env=os.environ.copy()
|
||||
)
|
||||
assert c.return_code == 0, (c.out, c.err)
|
||||
assert is_in_path(c.out.strip(), str(virtualenv)), (c.out.strip(), str(virtualenv))
|
||||
c = delegator_run(
|
||||
"pipenv clean --dry-run", cwd=os.path.abspath(p.path),
|
||||
env=os.environ.copy()
|
||||
)
|
||||
assert c.return_code == 0, (c.out, c.err)
|
||||
assert "click" in c.out, c.out
|
||||
|
||||
|
||||
@pytest.mark.project
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
from __future__ import absolute_import, print_function
|
||||
import json
|
||||
import os
|
||||
|
||||
import pytest
|
||||
@@ -68,3 +69,46 @@ six = "*"
|
||||
c = p.pipenv('sync')
|
||||
assert c.return_code == 0
|
||||
assert lockfile_content == p.lockfile
|
||||
|
||||
|
||||
@pytest.mark.sync
|
||||
@pytest.mark.lock
|
||||
def test_sync_sequential_detect_errors(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
contents = """
|
||||
[packages]
|
||||
requests = "*"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
|
||||
c = p.pipenv('lock')
|
||||
assert c.return_code == 0
|
||||
|
||||
# Force hash mismatch when installing `requests`
|
||||
lock = p.lockfile
|
||||
lock['default']['requests']['hashes'] = ['sha256:' + '0' * 64]
|
||||
with open(p.lockfile_path, 'w') as f:
|
||||
json.dump(lock, f)
|
||||
|
||||
c = p.pipenv('sync --sequential')
|
||||
assert c.return_code != 0
|
||||
|
||||
|
||||
@pytest.mark.sync
|
||||
@pytest.mark.lock
|
||||
def test_sync_sequential_verbose(PipenvInstance, pypi):
|
||||
with PipenvInstance(pypi=pypi) as p:
|
||||
with open(p.pipfile_path, 'w') as f:
|
||||
contents = """
|
||||
[packages]
|
||||
requests = "*"
|
||||
""".strip()
|
||||
f.write(contents)
|
||||
|
||||
c = p.pipenv('lock')
|
||||
assert c.return_code == 0
|
||||
|
||||
c = p.pipenv('sync --sequential --verbose')
|
||||
for package in p.lockfile['default']:
|
||||
assert 'Successfully installed {}'.format(package) in c.out
|
||||
|
||||
Submodule
+1
Submodule tests/pypi added at f3260ec6bf
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
BIN
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
@@ -1,190 +0,0 @@
|
||||
{
|
||||
"info": {
|
||||
"author": "Ethan Furman",
|
||||
"author_email": "ethan@stoneleaf.us",
|
||||
"bugtrack_url": null,
|
||||
"classifiers": [
|
||||
"Development Status :: 5 - Production/Stable",
|
||||
"Intended Audience :: Developers",
|
||||
"License :: OSI Approved :: BSD License",
|
||||
"Programming Language :: Python",
|
||||
"Programming Language :: Python :: 2.4",
|
||||
"Programming Language :: Python :: 2.5",
|
||||
"Programming Language :: Python :: 2.6",
|
||||
"Programming Language :: Python :: 2.7",
|
||||
"Programming Language :: Python :: 3.3",
|
||||
"Programming Language :: Python :: 3.4",
|
||||
"Programming Language :: Python :: 3.5",
|
||||
"Topic :: Software Development"
|
||||
],
|
||||
"description": "enum --- support for enumerations\n========================================\n\nAn enumeration is a set of symbolic names (members) bound to unique, constant\nvalues. Within an enumeration, the members can be compared by identity, and\nthe enumeration itself can be iterated over.\n\n from enum import Enum\n\n class Fruit(Enum):\n apple = 1\n banana = 2\n orange = 3\n\n list(Fruit)\n # [<Fruit.apple: 1>, <Fruit.banana: 2>, <Fruit.orange: 3>]\n\n len(Fruit)\n # 3\n\n Fruit.banana\n # <Fruit.banana: 2>\n\n Fruit['banana']\n # <Fruit.banana: 2>\n\n Fruit(2)\n # <Fruit.banana: 2>\n\n Fruit.banana is Fruit['banana'] is Fruit(2)\n # True\n\n Fruit.banana.name\n # 'banana'\n\n Fruit.banana.value\n # 2\n\nRepository and Issue Tracker at https://bitbucket.org/stoneleaf/enum34.",
|
||||
"description_content_type": null,
|
||||
"docs_url": null,
|
||||
"download_url": "",
|
||||
"downloads": {
|
||||
"last_day": -1,
|
||||
"last_month": -1,
|
||||
"last_week": -1
|
||||
},
|
||||
"home_page": "https://bitbucket.org/stoneleaf/enum34",
|
||||
"keywords": "",
|
||||
"license": "BSD License",
|
||||
"maintainer": "",
|
||||
"maintainer_email": "",
|
||||
"name": "enum34",
|
||||
"package_url": "https://pypi.org/project/enum34/",
|
||||
"platform": "UNKNOWN",
|
||||
"project_url": "https://pypi.org/project/enum34/",
|
||||
"project_urls": {
|
||||
"Homepage": "https://bitbucket.org/stoneleaf/enum34"
|
||||
},
|
||||
"release_url": "https://pypi.org/project/enum34/1.1.6/",
|
||||
"requires_dist": null,
|
||||
"requires_python": "",
|
||||
"summary": "Python 3.4 Enum backported to 3.3, 3.2, 3.1, 2.7, 2.6, 2.5, and 2.4",
|
||||
"version": "1.1.6"
|
||||
},
|
||||
"last_serial": 2117417,
|
||||
"releases": {
|
||||
"1.1.6": [
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "68f6982cc07dde78f4b500db829860bd",
|
||||
"sha256": "6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6-py2-none-any.whl",
|
||||
"has_sig": false,
|
||||
"md5_digest": "68f6982cc07dde78f4b500db829860bd",
|
||||
"packagetype": "bdist_wheel",
|
||||
"python_version": "py2",
|
||||
"requires_python": null,
|
||||
"size": 12427,
|
||||
"upload_time": "2016-05-16T03:31:13",
|
||||
"url": "https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl"
|
||||
},
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "a63ecb4f0b1b85fb69be64bdea999b43",
|
||||
"sha256": "644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6-py3-none-any.whl",
|
||||
"has_sig": false,
|
||||
"md5_digest": "a63ecb4f0b1b85fb69be64bdea999b43",
|
||||
"packagetype": "bdist_wheel",
|
||||
"python_version": "py3",
|
||||
"requires_python": null,
|
||||
"size": 12428,
|
||||
"upload_time": "2016-05-16T03:31:19",
|
||||
"url": "https://files.pythonhosted.org/packages/af/42/cb9355df32c69b553e72a2e28daee25d1611d2c0d9c272aa1d34204205b2/enum34-1.1.6-py3-none-any.whl"
|
||||
},
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "5f13a0841a61f7fc295c514490d120d0",
|
||||
"sha256": "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6.tar.gz",
|
||||
"has_sig": false,
|
||||
"md5_digest": "5f13a0841a61f7fc295c514490d120d0",
|
||||
"packagetype": "sdist",
|
||||
"python_version": "source",
|
||||
"requires_python": null,
|
||||
"size": 40048,
|
||||
"upload_time": "2016-05-16T03:31:30",
|
||||
"url": "https://files.pythonhosted.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz"
|
||||
},
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "61ad7871532d4ce2d77fac2579237a9e",
|
||||
"sha256": "2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6.zip",
|
||||
"has_sig": false,
|
||||
"md5_digest": "61ad7871532d4ce2d77fac2579237a9e",
|
||||
"packagetype": "sdist",
|
||||
"python_version": "source",
|
||||
"requires_python": null,
|
||||
"size": 44773,
|
||||
"upload_time": "2016-05-16T03:31:48",
|
||||
"url": "https://files.pythonhosted.org/packages/e8/26/a6101edcf724453845c850281b96b89a10dac6bd98edebc82634fccce6a5/enum34-1.1.6.zip"
|
||||
}
|
||||
]
|
||||
},
|
||||
"urls": [
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "68f6982cc07dde78f4b500db829860bd",
|
||||
"sha256": "6bd0f6ad48ec2aa117d3d141940d484deccda84d4fcd884f5c3d93c23ecd8c79"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6-py2-none-any.whl",
|
||||
"has_sig": false,
|
||||
"md5_digest": "68f6982cc07dde78f4b500db829860bd",
|
||||
"packagetype": "bdist_wheel",
|
||||
"python_version": "py2",
|
||||
"requires_python": null,
|
||||
"size": 12427,
|
||||
"upload_time": "2016-05-16T03:31:13",
|
||||
"url": "https://files.pythonhosted.org/packages/c5/db/e56e6b4bbac7c4a06de1c50de6fe1ef3810018ae11732a50f15f62c7d050/enum34-1.1.6-py2-none-any.whl"
|
||||
},
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "a63ecb4f0b1b85fb69be64bdea999b43",
|
||||
"sha256": "644837f692e5f550741432dd3f223bbb9852018674981b1664e5dc339387588a"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6-py3-none-any.whl",
|
||||
"has_sig": false,
|
||||
"md5_digest": "a63ecb4f0b1b85fb69be64bdea999b43",
|
||||
"packagetype": "bdist_wheel",
|
||||
"python_version": "py3",
|
||||
"requires_python": null,
|
||||
"size": 12428,
|
||||
"upload_time": "2016-05-16T03:31:19",
|
||||
"url": "https://files.pythonhosted.org/packages/af/42/cb9355df32c69b553e72a2e28daee25d1611d2c0d9c272aa1d34204205b2/enum34-1.1.6-py3-none-any.whl"
|
||||
},
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "5f13a0841a61f7fc295c514490d120d0",
|
||||
"sha256": "8ad8c4783bf61ded74527bffb48ed9b54166685e4230386a9ed9b1279e2df5b1"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6.tar.gz",
|
||||
"has_sig": false,
|
||||
"md5_digest": "5f13a0841a61f7fc295c514490d120d0",
|
||||
"packagetype": "sdist",
|
||||
"python_version": "source",
|
||||
"requires_python": null,
|
||||
"size": 40048,
|
||||
"upload_time": "2016-05-16T03:31:30",
|
||||
"url": "https://files.pythonhosted.org/packages/bf/3e/31d502c25302814a7c2f1d3959d2a3b3f78e509002ba91aea64993936876/enum34-1.1.6.tar.gz"
|
||||
},
|
||||
{
|
||||
"comment_text": "",
|
||||
"digests": {
|
||||
"md5": "61ad7871532d4ce2d77fac2579237a9e",
|
||||
"sha256": "2d81cbbe0e73112bdfe6ef8576f2238f2ba27dd0d55752a776c41d38b7da2850"
|
||||
},
|
||||
"downloads": -1,
|
||||
"filename": "enum34-1.1.6.zip",
|
||||
"has_sig": false,
|
||||
"md5_digest": "61ad7871532d4ce2d77fac2579237a9e",
|
||||
"packagetype": "sdist",
|
||||
"python_version": "source",
|
||||
"requires_python": null,
|
||||
"size": 44773,
|
||||
"upload_time": "2016-05-16T03:31:48",
|
||||
"url": "https://files.pythonhosted.org/packages/e8/26/a6101edcf724453845c850281b96b89a10dac6bd98edebc82634fccce6a5/enum34-1.1.6.zip"
|
||||
}
|
||||
]
|
||||
}
|
||||
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user