mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
Merge branch 'master' into pew-associate-project-dir
This commit is contained in:
@@ -0,0 +1,29 @@
|
||||
---
|
||||
name: Bug report
|
||||
about: Create a report to help us improve
|
||||
|
||||
---
|
||||
|
||||
Be sure to check the existing issues (both open and closed!).
|
||||
|
||||
Describe the issue briefly here.
|
||||
|
||||
Please run `$ python -m pipenv.help`, and paste the results here.
|
||||
|
||||
If you're on MacOS, just run the following:
|
||||
|
||||
$ python -m pipenv.help | pbcopy
|
||||
|
||||
------------
|
||||
|
||||
##### Expected result
|
||||
|
||||
Describe what you expected.
|
||||
|
||||
##### Actual result
|
||||
|
||||
When possible, provide the verbose output (`--verbose`), especially for locking and dependencies resolving issues.
|
||||
|
||||
##### Steps to replicate
|
||||
|
||||
Provide the steps to replicate (which usually at least includes the commands and the Pipfile).
|
||||
@@ -0,0 +1,7 @@
|
||||
---
|
||||
name: Usage / Requests for Help
|
||||
about: Requests for assistance or general usage guidance.
|
||||
|
||||
---
|
||||
|
||||
Please refer to our [StackOverflow tag](https://stackoverflow.com/questions/tagged/pipenv) for more information.
|
||||
@@ -0,0 +1,17 @@
|
||||
---
|
||||
name: Feature request
|
||||
about: Suggest an idea for this project
|
||||
|
||||
---
|
||||
|
||||
**Is your feature request related to a problem? Please describe.**
|
||||
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
|
||||
|
||||
**Describe the solution you'd like**
|
||||
A clear and concise description of what you want to happen.
|
||||
|
||||
**Describe alternatives you've considered**
|
||||
A clear and concise description of any alternative solutions or features you've considered.
|
||||
|
||||
**Additional context**
|
||||
Add any other context or screenshots about the feature request here.
|
||||
@@ -0,0 +1,57 @@
|
||||
# Contribution Guidelines
|
||||
|
||||
Before opening any issues or proposing any pull requests, please do the
|
||||
following:
|
||||
|
||||
1. Read our [Contributor's Guide](http://docs.pipenv.org/en/latest/dev/contributing/).
|
||||
2. Understand our [development philosophy](http://docs.pipenv.org/en/latest/dev/philosophy/).
|
||||
|
||||
To get the greatest chance of helpful responses, please also observe the
|
||||
following additional notes.
|
||||
|
||||
## Questions
|
||||
|
||||
The GitHub issue tracker is for *bug reports* and *feature requests*. Please do
|
||||
not use it to ask questions about how to use Pipenv. These questions should
|
||||
instead be directed to [Stack Overflow](https://stackoverflow.com/). Make sure
|
||||
that your question is tagged with the `pipenv` tag when asking it on
|
||||
Stack Overflow, to ensure that it is answered promptly and accurately.
|
||||
|
||||
## Good Bug Reports
|
||||
|
||||
Please be aware of the following things when filing bug reports:
|
||||
|
||||
1. Avoid raising duplicate issues. *Please* use the GitHub issue search feature
|
||||
to check whether your bug report or feature request has been mentioned in
|
||||
the past. Duplicate bug reports and feature requests are a huge maintenance
|
||||
burden on the limited resources of the project. If it is clear from your
|
||||
report that you would have struggled to find the original, that's ok, but
|
||||
if searching for a selection of words in your issue title would have found
|
||||
the duplicate then the issue will likely be closed extremely abruptly.
|
||||
2. When filing bug reports about exceptions or tracebacks, please include the
|
||||
*complete* traceback. Partial tracebacks, or just the exception text, are
|
||||
not helpful. Issues that do not contain complete tracebacks may be closed
|
||||
without warning.
|
||||
3. Make sure you provide a suitable amount of information to work with. This
|
||||
means you should provide:
|
||||
|
||||
- Guidance on **how to reproduce the issue**. Ideally, this should be a
|
||||
*small* code sample that can be run immediately by the maintainers.
|
||||
Failing that, let us know what you're doing, how often it happens, what
|
||||
environment you're using, etc. Be thorough: it prevents us needing to ask
|
||||
further questions.
|
||||
- Tell us **what you expected to happen**. When we run your example code,
|
||||
what are we expecting to happen? What does "success" look like for your
|
||||
code?
|
||||
- Tell us **what actually happens**. It's not helpful for you to say "it
|
||||
doesn't work" or "it fails". Tell us *how* it fails: do you get an
|
||||
exception? A hang? The packages installed seem incorrect?
|
||||
How was the actual result different from your expected result?
|
||||
- Tell us **what version of Pipenv you're using**, and
|
||||
**how you installed it**. Different versions of Pipenv behave
|
||||
differently and have different bugs, and some distributors of Pipenv
|
||||
ship patches on top of the code we supply.
|
||||
|
||||
If you do not provide all of these things, it will take us much longer to
|
||||
fix your problem. If we ask you to clarify these and you never respond, we
|
||||
will close your issue without fixing it.
|
||||
@@ -1,20 +0,0 @@
|
||||
Contributing to pipenv
|
||||
======================
|
||||
|
||||
To work on pipenv itself, fork the repository and clone your fork to your local
|
||||
system.
|
||||
|
||||
Now, install the development requirements::
|
||||
|
||||
cd pipenv
|
||||
virtualenv ~/pipenv-venv # You can use a different path if you like.
|
||||
source ~/pipenv-venv/bin/activate
|
||||
python setup.py develop
|
||||
pipenv install --dev
|
||||
|
||||
|
||||
To run the test suite locally::
|
||||
|
||||
pipenv run pytest tests
|
||||
|
||||
|
||||
+24
-1
@@ -1,3 +1,26 @@
|
||||
2018.05.12:
|
||||
- Switch to calver for versioning.
|
||||
11.10.4:
|
||||
- Bugfix release (_mkstmp_inner backport breaks python3.4/3.5 compat)
|
||||
11.10.3:
|
||||
- Bugfix release (break dependency on pathlib2).
|
||||
11.10.2:
|
||||
- Backport NamedTemporaryFile for python 2.
|
||||
- Implement atomic lockfile writing / rewriting.
|
||||
- Allow non-interactive pyenv installations for CI.
|
||||
- Bugfix regression which restricted pipfiles to two sources.
|
||||
- Update default python 2.7 version to 2.7.15.
|
||||
- Fix bug preventing usage within premade virtualenvs.
|
||||
- Add PIPENV_MAX_RETRIES environment variable to allow retrying installs.
|
||||
- Fix regression with `pipenv sync` which caused it to lock if out of sync.
|
||||
- Update colorblind mode to respect progress bars.
|
||||
- Use `\n` to generate new lockfiles and pipfiles, default to current newlines.
|
||||
- Fix bug with environment variable expansion writing back to Pipfiles when
|
||||
running `pipenv install <package>`
|
||||
- Accurately parse extras from egg fragments.
|
||||
- Allow `editable=False` in pipfile.
|
||||
- Fix `keep-outdated` argument for installation (previously unenforced).
|
||||
- Update vendoring scripts to include licenses for vendored pip.
|
||||
11.10.1:
|
||||
- Fix broken resolution when using multiple sources in pipfiles and passing
|
||||
`--skip-lock`.
|
||||
@@ -30,7 +53,7 @@
|
||||
- Bugfix for allow_global with new resolver fixes.
|
||||
- Locally cache hashes for performance gains.
|
||||
- Lock prereleases correctly.
|
||||
- Add reqeuests.pem back to package.
|
||||
- Add requests.pem back to package.
|
||||
- Auto-toggle PIPENV_VENV_IN_PROJECT when .venv is present.
|
||||
- Fix bug with pipfile casing.
|
||||
- Enable environment variable interpolation in pipfiles.
|
||||
|
||||
+1
-1
@@ -18,7 +18,7 @@ Pipenv: Python Development Workflow for Humans
|
||||
|
||||
---------------
|
||||
|
||||
**Pipenv** — the officially recommended Python packaging tool from `Python.org <https://packaging.python.org/tutorials/managing-dependencies/#managing-dependencies>`_, free (as in freedom).
|
||||
**Pipenv** — the tool for managing application dependencies from `PyPA <https://www.pypa.io/en/latest/>`__, free (as in freedom).
|
||||
|
||||
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. *Windows is a first–class citizen, in our world.*
|
||||
|
||||
|
||||
@@ -0,0 +1,122 @@
|
||||
Contributing to Pipenv
|
||||
======================
|
||||
|
||||
If you're reading this, you're probably interested in contributing to Pipenv.
|
||||
Thank you very much! Open source projects live-and-die based on the support
|
||||
they receive from others, and the fact that you're even considering
|
||||
contributing to the Pipenv project is *very* generous of you.
|
||||
|
||||
This document lays out guidelines and advice for contributing to this project.
|
||||
If you're thinking of contributing, please start by reading this document and
|
||||
getting a feel for how contributing to this project works. If you have any
|
||||
questions, feel free to reach out to either `Dan Ryan`_, `Tzu-ping Chung`_,
|
||||
or `Nate Prewitt`_, the primary maintainers.
|
||||
|
||||
.. _Dan Ryan: https://github.com/techalchemy
|
||||
.. _Tzu-ping Chung: https://github.com/uranusjr
|
||||
.. _Nate Prewitt: https://github.com/nateprewitt
|
||||
|
||||
The guide is split into sections based on the type of contribution you're
|
||||
thinking of making, with a section that covers general guidelines for all
|
||||
contributors.
|
||||
|
||||
Be Cordial
|
||||
----------
|
||||
|
||||
**Be cordial or be on your way**. *—Kenneth Reitz*
|
||||
|
||||
Pipenv has one very important rule governing all forms of contribution,
|
||||
including reporting bugs or requesting features. This golden rule is
|
||||
"`be cordial or be on your way`_".
|
||||
|
||||
**All contributions are welcome**, as long as
|
||||
everyone involved is treated with respect.
|
||||
|
||||
.. _be cordial or be on your way: http://kennethreitz.org/be-cordial-or-be-on-your-way/
|
||||
|
||||
.. _early-feedback:
|
||||
|
||||
Get Early Feedback
|
||||
------------------
|
||||
|
||||
If you are contributing, do not feel the need to sit on your contribution until
|
||||
it is perfectly polished and complete. It helps everyone involved for you to
|
||||
seek feedback as early as you possibly can. Submitting an early, unfinished
|
||||
version of your contribution for feedback in no way prejudices your chances of
|
||||
getting that contribution accepted, and can save you from putting a lot of work
|
||||
into a contribution that is not suitable for the project.
|
||||
|
||||
Contribution Suitability
|
||||
------------------------
|
||||
|
||||
Our project maintainers have the last word on whether or not a contribution is
|
||||
suitable for Pipenv. All contributions will be considered carefully, but from
|
||||
time to time, contributions will be rejected because they do not suit the
|
||||
current goals or needs of the project.
|
||||
|
||||
If your contribution is rejected, don't despair! As long as you followed these
|
||||
guidelines, you will have a much better chance of getting your next
|
||||
contribution accepted.
|
||||
|
||||
Code Contributions
|
||||
------------------
|
||||
|
||||
Steps for Submitting Code
|
||||
~~~~~~~~~~~~~~~~~~~~~~~~~
|
||||
|
||||
When contributing code, you'll want to follow this checklist:
|
||||
|
||||
1. Fork the repository on GitHub.
|
||||
2. Run the tests to confirm they all pass on your system. If they don't, you'll
|
||||
need to investigate why they fail. If you're unable to diagnose this
|
||||
yourself, raise it as a bug report by following the guidelines in this
|
||||
document: :ref:`bug-reports`.
|
||||
3. Write tests that demonstrate your bug or feature. Ensure that they fail.
|
||||
4. Make your change.
|
||||
5. Run the entire test suite again, confirming that all tests pass *including
|
||||
the ones you just added*.
|
||||
6. Send a GitHub Pull Request to the main repository's ``master`` branch.
|
||||
GitHub Pull Pipenv are the expected method of code collaboration on this
|
||||
project.
|
||||
|
||||
The following sub-sections go into more detail on some of the points above.
|
||||
|
||||
Code Review
|
||||
~~~~~~~~~~~
|
||||
|
||||
Contributions will not be merged until they've been code reviewed. You should
|
||||
implement any code review feedback unless you strongly object to it. In the
|
||||
event that you object to the code review feedback, you should make your case
|
||||
clearly and calmly. If, after doing so, the feedback is judged to still apply,
|
||||
you must either apply the feedback or withdraw your contribution.
|
||||
|
||||
Documentation Contributions
|
||||
---------------------------
|
||||
|
||||
Documentation improvements are always welcome! The documentation files live in
|
||||
the ``docs/`` directory of the codebase. They're written in
|
||||
`reStructuredText`_, and use `Sphinx`_ to generate the full suite of
|
||||
documentation.
|
||||
|
||||
When contributing documentation, please do your best to follow the style of the
|
||||
documentation files. This means a soft-limit of 79 characters wide in your text
|
||||
files and a semi-formal, yet friendly and approachable, prose style.
|
||||
|
||||
When presenting Python code, use single-quoted strings (``'hello'`` instead of
|
||||
``"hello"``).
|
||||
|
||||
.. _reStructuredText: http://docutils.sourceforge.net/rst.html
|
||||
.. _Sphinx: http://sphinx-doc.org/index.html
|
||||
|
||||
|
||||
.. _bug-reports:
|
||||
|
||||
Bug Reports
|
||||
-----------
|
||||
|
||||
Bug reports are hugely important! Before you raise one, though, please check
|
||||
through the `GitHub issues`_, **both open and closed**, to confirm that the bug
|
||||
hasn't been reported before. Duplicate bug reports are a huge drain on the time
|
||||
of other contributors, and should be avoided as much as possible.
|
||||
|
||||
.. _GitHub issues: https://github.com/pypa/pipenv/issues
|
||||
@@ -0,0 +1,23 @@
|
||||
Development Philosophy
|
||||
======================
|
||||
|
||||
Pipenv is an open but opinionated tool, created by an open but opinionated developer.
|
||||
|
||||
|
||||
Management Style
|
||||
~~~~~~~~~~~~~~~~
|
||||
|
||||
`Kenneth Reitz <http://kennethreitz.org>`_ is the BDFL. He has final say in any decision related to the Pipenv project. Kenneth is responsible for the direction and form of the library, as well as its presentation. In addition to making decisions based on technical merit, he is responsible for making decisions based on the development philosophy of Pipenv.
|
||||
|
||||
`Dan Ryan<http://github.com/techalchemy>`_, `Tzu-ping Chung<https://github.com/uranusjr>`_, and `Nate Prewitt<https://github.com/nateprewitt>`_ are the core contributors.
|
||||
They are responsible for triaging bug reports, reviewing pull requests and ensuring that Kenneth is kept up to speed with developments around the library.
|
||||
The day-to-day managing of the project is done by the core contributors. They are responsible for making judgements about whether or not a feature request is
|
||||
likely to be accepted by Kenneth.
|
||||
|
||||
Values
|
||||
~~~~~~
|
||||
|
||||
- Simplicity is always better than functionality.
|
||||
- Listen to everyone, then disregard it.
|
||||
- The API is all that matters. Everything else is secondary.
|
||||
- Fit the 90% use-case. Ignore the nay-sayers.
|
||||
+1
-1
@@ -20,7 +20,7 @@ Pipenv: Python Dev Workflow for Humans
|
||||
|
||||
---------------
|
||||
|
||||
**Pipenv** — the officially recommended Python packaging tool from `Python.org <https://packaging.python.org/tutorials/managing-dependencies/#managing-dependencies>`_, free (as in freedom).
|
||||
**Pipenv** — the tool for managing application dependencies from `PyPA <https://www.pypa.io/en/latest/>`__, free (as in freedom).
|
||||
|
||||
Pipenv is a tool that aims to bring the best of all packaging worlds (bundler, composer, npm, cargo, yarn, etc.) to the Python world. *Windows is a first-class citizen, in our world.*
|
||||
|
||||
|
||||
@@ -2,4 +2,4 @@
|
||||
# // ) ) / / // ) ) //___) ) // ) ) || / /
|
||||
# //___/ / / / //___/ / // // / / || / /
|
||||
# // / / // ((____ // / / ||/ /
|
||||
__version__ = '11.10.2.dev1'
|
||||
__version__ = '2018.05.18'
|
||||
|
||||
+2
-1
@@ -8,6 +8,7 @@ import functools
|
||||
import io
|
||||
import os
|
||||
import six
|
||||
import sys
|
||||
import warnings
|
||||
from tempfile import _bin_openflags, gettempdir, _mkstemp_inner, mkdtemp
|
||||
from .utils import (logging, rmtree)
|
||||
@@ -257,7 +258,7 @@ def NamedTemporaryFile(
|
||||
# the file when it is closed. This is only supported by Windows.
|
||||
if os.name == "nt" and delete:
|
||||
flags |= os.O_TEMPORARY
|
||||
if six.PY2:
|
||||
if sys.version_info < (3, 5):
|
||||
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags)
|
||||
else:
|
||||
(fd, name) = _mkstemp_inner(dir, prefix, suffix, flags, output_type)
|
||||
|
||||
+3
-2
@@ -841,13 +841,14 @@ def update(
|
||||
)
|
||||
@option('--bare', is_flag=True, default=False, help="Minimal output.")
|
||||
@option('--json', is_flag=True, default=False, help="Output JSON.")
|
||||
@option('--json-tree', is_flag=True, default=False, help="Output JSON in nested tree.")
|
||||
@option(
|
||||
'--reverse', is_flag=True, default=False, help="Reversed dependency graph."
|
||||
)
|
||||
def graph(bare=False, json=False, reverse=False):
|
||||
def graph(bare=False, json=False, json_tree=False, reverse=False):
|
||||
from .core import do_graph
|
||||
|
||||
do_graph(bare=bare, json=json, reverse=reverse)
|
||||
do_graph(bare=bare, json=json, json_tree=json_tree, reverse=reverse)
|
||||
|
||||
|
||||
@command(short_help="View a given module in your editor.", name="open")
|
||||
|
||||
+48
-3
@@ -884,10 +884,13 @@ def do_create_virtualenv(python=None, site_packages=False):
|
||||
crayons.normal(u'Creating a virtualenv for this project…', bold=True),
|
||||
err=True,
|
||||
)
|
||||
click.echo(u'Pipfile: {0}'.format(
|
||||
crayons.red(project.pipfile_location, bold=True),
|
||||
), err=True)
|
||||
# The user wants the virtualenv in the project.
|
||||
if project.is_venv_in_project():
|
||||
cmd = [
|
||||
'virtualenv',
|
||||
sys.executable, '-m', 'virtualenv',
|
||||
project.virtualenv_location,
|
||||
'--prompt=({0})'.format(project.name),
|
||||
]
|
||||
@@ -1348,7 +1351,9 @@ def do_init(
|
||||
do_lock(system=system, pre=pre, keep_outdated=keep_outdated)
|
||||
# Write out the lockfile if it doesn't exist.
|
||||
if not project.lockfile_exists and not skip_lock:
|
||||
if system or allow_global and not PIPENV_VIRTUALENV:
|
||||
# Unless we're in a virtualenv not managed by pipenv, abort if we're
|
||||
# using the system's python.
|
||||
if (system or allow_global) and not PIPENV_VIRTUALENV:
|
||||
click.echo(
|
||||
'{0}: --system is intended to be used for Pipfile installation, '
|
||||
'not installation of specific packages. Aborting.'.format(
|
||||
@@ -2014,6 +2019,14 @@ def do_install(
|
||||
err=True,
|
||||
)
|
||||
click.echo(crayons.blue(format_pip_error(c.err)), err=True)
|
||||
if 'setup.py egg_info' in c.err:
|
||||
click.echo(
|
||||
"This is likely caused by a bug in {0}. "
|
||||
"Report this to its maintainers.".format(
|
||||
crayons.green(package_name),
|
||||
),
|
||||
err=True,
|
||||
)
|
||||
requirements_directory.cleanup()
|
||||
sys.exit(1)
|
||||
click.echo(
|
||||
@@ -2398,7 +2411,7 @@ def do_check(three=None, python=False, system=False, unused=False, args=None):
|
||||
sys.exit(1)
|
||||
|
||||
|
||||
def do_graph(bare=False, json=False, reverse=False):
|
||||
def do_graph(bare=False, json=False, json_tree=False, reverse=False):
|
||||
import pipdeptree
|
||||
try:
|
||||
python_path = which('python')
|
||||
@@ -2422,9 +2435,31 @@ def do_graph(bare=False, json=False, reverse=False):
|
||||
err=True,
|
||||
)
|
||||
sys.exit(1)
|
||||
if reverse and json_tree:
|
||||
click.echo(
|
||||
u'{0}: {1}'.format(
|
||||
crayons.red('Warning', bold=True),
|
||||
u'Using both --reverse and --json-tree together is not supported. '
|
||||
u'Please select one of the two options.',
|
||||
),
|
||||
err=True,
|
||||
)
|
||||
sys.exit(1)
|
||||
if json and json_tree:
|
||||
click.echo(
|
||||
u'{0}: {1}'.format(
|
||||
crayons.red('Warning', bold=True),
|
||||
u'Using both --json and --json-tree together is not supported. '
|
||||
u'Please select one of the two options.',
|
||||
),
|
||||
err=True,
|
||||
)
|
||||
sys.exit(1)
|
||||
flag = ''
|
||||
if json:
|
||||
flag = '--json'
|
||||
if json_tree:
|
||||
flag = '--json-tree'
|
||||
if reverse:
|
||||
flag = '--reverse'
|
||||
if not project.virtualenv_exists:
|
||||
@@ -2454,6 +2489,16 @@ def do_graph(bare=False, json=False, reverse=False):
|
||||
data.append(d)
|
||||
click.echo(simplejson.dumps(data, indent=4))
|
||||
sys.exit(0)
|
||||
elif json_tree:
|
||||
def traverse(obj):
|
||||
if isinstance(obj, list):
|
||||
return [traverse(package) for package in obj if package['key'] not in BAD_PACKAGES]
|
||||
else:
|
||||
obj['dependencies'] = traverse(obj['dependencies'])
|
||||
return obj
|
||||
data = traverse(simplejson.loads(c.out))
|
||||
click.echo(simplejson.dumps(data, indent=4))
|
||||
sys.exit(0)
|
||||
else:
|
||||
for line in c.out.split('\n'):
|
||||
# Ignore bad packages as top level.
|
||||
|
||||
@@ -23,6 +23,9 @@ PIPENV_COLORBLIND = bool(os.environ.get('PIPENV_COLORBLIND'))
|
||||
PIPENV_NOSPIN = bool(os.environ.get('PIPENV_NOSPIN'))
|
||||
# Tells Pipenv how many rounds of resolving to do for Pip-Tools.
|
||||
PIPENV_MAX_ROUNDS = int(os.environ.get('PIPENV_MAX_ROUNDS', '16'))
|
||||
# Specify how many retries Pipenv should attempt for network requests.
|
||||
default_retries = '1' if 'CI' in os.environ else '0'
|
||||
PIPENV_MAX_RETRIES = int(os.environ.get('PIPENV_MAX_RETRIES', default_retries))
|
||||
# Specify a custom Pipfile location.
|
||||
PIPENV_PIPFILE = os.environ.get('PIPENV_PIPFILE')
|
||||
# Tells Pipenv which Python to default to, when none is provided.
|
||||
|
||||
@@ -9,7 +9,7 @@ from functools import partial, wraps
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
from pipenv.vendor.pathlib2 import Path
|
||||
from tempfile import NamedTemporaryFile as _ntf
|
||||
try:
|
||||
from shutil import which
|
||||
|
||||
@@ -11,7 +11,7 @@ from subprocess import CalledProcessError
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pathlib2 import Path
|
||||
from pipenv.vendor.pathlib2 import Path
|
||||
|
||||
try:
|
||||
from shutil import get_terminal_size
|
||||
@@ -215,6 +215,8 @@ def shell(env, cwd=None):
|
||||
inve(env, shell, '-c', shell_check)
|
||||
except CalledProcessError:
|
||||
return
|
||||
if shell_name in ('Cmder', 'cmd'):
|
||||
os.environ['PROMPT'] = '({0}) {1}'.format(env, os.environ['PROMPT'])
|
||||
if shell_name == 'bash':
|
||||
fork_bash(env, cwd)
|
||||
elif shell_name == 'Cmder':
|
||||
|
||||
+7
-1
@@ -45,7 +45,11 @@ except ImportError:
|
||||
from distutils.spawn import find_executable
|
||||
from contextlib import contextmanager
|
||||
from .pep508checker import lookup
|
||||
from .environments import PIPENV_MAX_ROUNDS, PIPENV_CACHE_DIR
|
||||
from .environments import (
|
||||
PIPENV_MAX_ROUNDS,
|
||||
PIPENV_CACHE_DIR,
|
||||
PIPENV_MAX_RETRIES
|
||||
)
|
||||
|
||||
try:
|
||||
from collections.abc import Mapping
|
||||
@@ -72,6 +76,8 @@ def _get_requests_session():
|
||||
return requests_session
|
||||
import requests
|
||||
requests_session = requests.Session()
|
||||
adapter = requests.adapters.HTTPAdapter(max_retries=PIPENV_MAX_RETRIES)
|
||||
requests_session.mount('https://pypi.org/pypi', adapter)
|
||||
return requests_session
|
||||
|
||||
|
||||
|
||||
Vendored
+1
-1
@@ -16,4 +16,4 @@ if __package__ == '':
|
||||
import pip9 # noqa
|
||||
|
||||
if __name__ == '__main__':
|
||||
sys.exit(pip.main())
|
||||
sys.exit(pip9.main())
|
||||
|
||||
Vendored
-4433
File diff suppressed because it is too large
Load Diff
@@ -27,7 +27,6 @@ required = [
|
||||
'setuptools>=36.2.1',
|
||||
'virtualenv-clone>=0.2.5',
|
||||
'virtualenv',
|
||||
'pathlib2==2.1.0;python_version<"3.4"',
|
||||
'requests[security];python_version<"2.7"',
|
||||
'ordereddict;python_version<"2.7"',
|
||||
]
|
||||
@@ -88,7 +87,7 @@ class UploadCommand(Command):
|
||||
except FileNotFoundError:
|
||||
pass
|
||||
self.status('Building Source distribution…')
|
||||
os.system('{0} setup.py sdist'.format(sys.executable))
|
||||
os.system('{0} setup.py sdist bdist_wheel'.format(sys.executable))
|
||||
self.status('Uploading the package to PyPi via Twine…')
|
||||
os.system('twine upload dist/*')
|
||||
self.status('Pushing git tags…')
|
||||
@@ -114,6 +113,7 @@ setup(
|
||||
]
|
||||
},
|
||||
package_data={
|
||||
'': ['LICENSE', 'NOTICES'],
|
||||
"pipenv.vendor.requests": ["*.pem"],
|
||||
"pipenv.vendor.certifi": ["*.pem"],
|
||||
"pipenv.patched.notpip._vendor.certifi": ["*.pem"],
|
||||
|
||||
@@ -84,14 +84,16 @@ def log(msg):
|
||||
print('[vendoring.%s] %s' % (TASK_NAME, msg))
|
||||
|
||||
|
||||
def _get_git_root(ctx):
|
||||
return Path(ctx.run('git rev-parse --show-toplevel', hide=True).stdout.strip())
|
||||
|
||||
|
||||
def _get_vendor_dir(ctx):
|
||||
git_root = ctx.run('git rev-parse --show-toplevel', hide=True).stdout
|
||||
return Path(git_root.strip()) / 'pipenv' / 'vendor'
|
||||
return _get_git_root(ctx) / 'pipenv' / 'vendor'
|
||||
|
||||
|
||||
def _get_patched_dir(ctx):
|
||||
git_root = ctx.run('git rev-parse --show-toplevel', hide=True).stdout
|
||||
return Path(git_root.strip()) / 'pipenv' / 'patched'
|
||||
return _get_git_root(ctx) / 'pipenv' / 'patched'
|
||||
|
||||
|
||||
def clean_vendor(ctx, vendor_dir):
|
||||
@@ -321,7 +323,7 @@ def vendor(ctx, vendor_dir, rewrite=True):
|
||||
rewrite_file_imports(item, vendored_libs, vendor_dir)
|
||||
write_backport_imports(ctx, vendor_dir)
|
||||
log('Applying post-patches...')
|
||||
patches = patch_dir.glob('*.patch' if not is_patched else '_post*.patch')
|
||||
patches = patch_dir.glob('*.patch' if not is_patched else '_post*.patch')
|
||||
for patch in patches:
|
||||
apply_patch(ctx, patch)
|
||||
if is_patched:
|
||||
@@ -457,6 +459,22 @@ def extract_license_member(vendor_dir, tar, member, name):
|
||||
dest.write_bytes(tar.read(member))
|
||||
|
||||
|
||||
@invoke.task()
|
||||
def generate_patch(ctx, package_path, patch_description, base='HEAD'):
|
||||
pkg = Path(package_path)
|
||||
if len(pkg.parts) != 2 or pkg.parts[0] not in ('vendor', 'patched'):
|
||||
raise ValueError('example usage: generate-patch patched/pew some-description')
|
||||
patch_fn = '{0}-{1}.patch'.format(pkg.parts[1], patch_description)
|
||||
command = 'git diff {base} -p {root} > {out}'.format(
|
||||
base=base,
|
||||
root=Path('pipenv').joinpath(pkg),
|
||||
out=Path(__file__).parent.joinpath('patches', pkg.parts[0], patch_fn),
|
||||
)
|
||||
with ctx.cd(str(_get_git_root(ctx))):
|
||||
log(command)
|
||||
ctx.run(command)
|
||||
|
||||
|
||||
@invoke.task(name=TASK_NAME)
|
||||
def main(ctx):
|
||||
vendor_dir = _get_vendor_dir(ctx)
|
||||
|
||||
@@ -0,0 +1,13 @@
|
||||
diff --git a/pipenv/patched/pew/pew.py b/pipenv/patched/pew/pew.py
|
||||
index 2d3889a0..07dbdf4f 100644
|
||||
--- a/pipenv/patched/pew/pew.py
|
||||
+++ b/pipenv/patched/pew/pew.py
|
||||
@@ -215,6 +215,8 @@ def shell(env, cwd=None):
|
||||
inve(env, shell, '-c', shell_check)
|
||||
except CalledProcessError:
|
||||
return
|
||||
+ if shell_name in ('Cmder', 'cmd'):
|
||||
+ os.environ['PROMPT'] = '({0}) {1}'.format(env, os.environ['PROMPT'])
|
||||
if shell_name == 'bash':
|
||||
fork_bash(env, cwd)
|
||||
elif shell_name == 'Cmder':
|
||||
@@ -23,7 +23,7 @@ index d1d8e0a..c45c37e 100644
|
||||
+try:
|
||||
+ from pathlib import Path
|
||||
+except ImportError:
|
||||
+ from pathlib2 import Path
|
||||
+ from pipenv.vendor.pathlib2 import Path
|
||||
from tempfile import NamedTemporaryFile as _ntf
|
||||
try:
|
||||
from shutil import which
|
||||
@@ -39,7 +39,7 @@ index bcaabad..b8fc3e7 100644
|
||||
+try:
|
||||
+ from pathlib import Path
|
||||
+except ImportError:
|
||||
+ from pathlib2 import Path
|
||||
+ from pipenv.vendor.pathlib2 import Path
|
||||
|
||||
try:
|
||||
from shutil import get_terminal_size
|
||||
|
||||
@@ -10,6 +10,11 @@ from pipenv.vendor import requests
|
||||
from pipenv.vendor import six
|
||||
from pipenv.vendor import toml
|
||||
|
||||
try:
|
||||
from pathlib import Path
|
||||
except ImportError:
|
||||
from pipenv.vendor.pathlib2 import Path
|
||||
|
||||
|
||||
if six.PY2:
|
||||
class ResourceWarning(Warning):
|
||||
@@ -45,7 +50,7 @@ class _PipenvInstance(object):
|
||||
self.original_umask = os.umask(0o007)
|
||||
self.original_dir = os.path.abspath(os.curdir)
|
||||
self._path = TemporaryDirectory(suffix='-project', prefix='pipenv-')
|
||||
self.path = self._path.name
|
||||
self.path = str(Path(self._path.name).resolve())
|
||||
# set file creation perms
|
||||
self.pipfile_path = None
|
||||
self.chdir = chdir
|
||||
|
||||
@@ -48,6 +48,7 @@ def test_pipenv_graph(PipenvInstance, pypi):
|
||||
p.pipenv('install requests')
|
||||
assert 'requests' in p.pipenv('graph').out
|
||||
assert 'requests' in p.pipenv('graph --json').out
|
||||
assert 'requests' in p.pipenv('graph --json-tree').out
|
||||
|
||||
|
||||
@pytest.mark.cli
|
||||
|
||||
Reference in New Issue
Block a user