|
35 | 35 | convert_deps_from_pip, convert_deps_to_pip, is_required_version,
|
36 | 36 | proper_case, pep423_name, split_vcs, resolve_deps, shellquote, is_vcs,
|
37 | 37 | python_version, suggest_package, find_windows_executable, is_file,
|
38 |
| - prepare_pip_source_args, temp_environ |
| 38 | + prepare_pip_source_args, temp_environ, is_valid_url, download_file |
39 | 39 | )
|
40 | 40 | from .__version__ import __version__
|
41 | 41 | from . import pep508checker, progress
|
@@ -563,9 +563,9 @@ def ensure_virtualenv(three=None, python=None, site_packages=False):
|
563 | 563 |
|
564 | 564 | # If --three, --two, or --python were passed...
|
565 | 565 | elif (python) or (three is not None) or (site_packages is not False):
|
566 |
| - |
| 566 | + |
567 | 567 | USING_DEFAULT_PYTHON = False
|
568 |
| - |
| 568 | + |
569 | 569 | # Ensure python is installed before deleting existing virtual env
|
570 | 570 | ensure_python(three=three, python=python)
|
571 | 571 |
|
@@ -1745,9 +1745,27 @@ def install(
|
1745 | 1745 | if not pre:
|
1746 | 1746 | pre = project.settings.get('allow_prereleases')
|
1747 | 1747 |
|
| 1748 | + # Using current time to generate a random filename to avoid |
| 1749 | + now = time.localtime() |
| 1750 | + temporary_requirements = "requirments{0}{1}{2}{3}{4}{5}.txt".format( |
| 1751 | + now.tm_year, now.tm_mon, now.tm_mday, now.tm_hour, now.tm_min, now.tm_sec) |
| 1752 | + remote = requirements and is_valid_url(requirements) |
| 1753 | + # Check if the file is remote or not |
| 1754 | + if remote: |
| 1755 | + # Download requirements file |
| 1756 | + click.echo(crayons.normal(u'Remote requirements file provided! Downloading…',bold=True),err=True) |
| 1757 | + download_file(requirements, temporary_requirements) |
| 1758 | + # Replace the url with the temporary requirements file |
| 1759 | + requirements = temporary_requirements |
| 1760 | + remote = True |
| 1761 | + |
1748 | 1762 | if requirements:
|
1749 | 1763 | click.echo(crayons.normal(u'Requirements file provided! Importing into Pipfile…', bold=True), err=True)
|
1750 | 1764 | import_requirements(r=project.path_to(requirements), dev=dev)
|
| 1765 | + # If requirements file was provided by remote url delete the temporary file |
| 1766 | + |
| 1767 | + if remote: |
| 1768 | + os.remove(project.path_to(temporary_requirements)) |
1751 | 1769 |
|
1752 | 1770 | if code:
|
1753 | 1771 | click.echo(crayons.normal(u'Discovering imports from local codebase…', bold=True))
|
|
0 commit comments