mirror of
https://github.com/kennethreitz/pipenv.git
synced 2026-06-05 22:50:18 +00:00
+4
-1
@@ -12,7 +12,7 @@ import delegator
|
||||
from requests.compat import OrderedDict
|
||||
|
||||
from .utils import (format_toml, mkdir_p, convert_deps_from_pip,
|
||||
pep423_name, recase_file, find_requirements)
|
||||
pep423_name, recase_file, find_requirements, is_file)
|
||||
from .environments import PIPENV_MAX_DEPTH, PIPENV_VENV_IN_PROJECT
|
||||
from .environments import PIPENV_USE_SYSTEM
|
||||
|
||||
@@ -262,6 +262,9 @@ class Project(object):
|
||||
|
||||
key = 'dev-packages' if dev else 'packages'
|
||||
|
||||
if is_file(package_name):
|
||||
pass
|
||||
|
||||
# Set empty group if it doesn't exist yet.
|
||||
if key not in p:
|
||||
p[key] = {}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
# -*- coding: utf-8 -*-
|
||||
import os
|
||||
import hashlib
|
||||
import tempfile
|
||||
|
||||
from piptools.resolver import Resolver
|
||||
@@ -14,6 +15,7 @@ import six
|
||||
|
||||
# List of version control systems we support.
|
||||
VCS_LIST = ('git', 'svn', 'hg', 'bzr')
|
||||
FILE_LIST = ('http://', 'https://', 'ftp://')
|
||||
|
||||
requests = requests.session()
|
||||
|
||||
@@ -127,6 +129,16 @@ def convert_deps_from_pip(dep):
|
||||
import requirements
|
||||
req = [r for r in requirements.parse(dep)][0]
|
||||
|
||||
# File installs.
|
||||
if req.uri and not req.vcs:
|
||||
|
||||
# Assign a package name to the file, last 7 of it's sha256 hex digest.
|
||||
req.name = hashlib.sha256(req.uri.encode('utf-8')).hexdigest()
|
||||
req.name = req.name[len(req.name) - 7:]
|
||||
|
||||
# {file: uri} TOML (spec 3 I guess...)
|
||||
dependency[req.name] = {'file': req.uri}
|
||||
|
||||
# VCS Installs.
|
||||
if req.vcs:
|
||||
if req.name is None:
|
||||
@@ -203,6 +215,10 @@ def convert_deps_to_pip(deps, r=True):
|
||||
maybe_vcs = [vcs for vcs in VCS_LIST if vcs in deps[dep]]
|
||||
vcs = maybe_vcs[0] if maybe_vcs else None
|
||||
|
||||
# Support for files.
|
||||
if 'file' in deps[dep]:
|
||||
dep = deps[dep]['file']
|
||||
|
||||
if vcs:
|
||||
extra = '{0}+{1}'.format(vcs, deps[dep][vcs])
|
||||
|
||||
@@ -271,6 +287,15 @@ def is_vcs(pipfile_entry):
|
||||
return False
|
||||
|
||||
|
||||
def is_file(package):
|
||||
"""Determine if a package name is for a File dependency."""
|
||||
for start in FILE_LIST:
|
||||
if package.startswith(start):
|
||||
return True
|
||||
|
||||
return False
|
||||
|
||||
|
||||
def pep440_version(version):
|
||||
"""Normalize version to PEP 440 standards"""
|
||||
|
||||
|
||||
Reference in New Issue
Block a user