-
-
Notifications
You must be signed in to change notification settings - Fork 1.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Remove patch to safety/__main__.py to handle pyyaml
This is really not needed anymore. k# Your branch is up to date with 'origin/vendoring-improvements'.
- Loading branch information
Showing
2 changed files
with
1 addition
and
101 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,51 +1,8 @@ | ||
"""Allow safety to be executable through `python -m safety`.""" | ||
from __future__ import absolute_import | ||
|
||
import os | ||
import sys | ||
import sysconfig | ||
|
||
|
||
PATCHED_DIR = os.path.dirname(os.path.dirname(os.path.abspath(__file__))) | ||
PIPENV_DIR = os.path.dirname(PATCHED_DIR) | ||
VENDORED_DIR = os.path.join("PIPENV_DIR", "vendor") | ||
|
||
|
||
def get_site_packages(): | ||
prefixes = {sys.prefix, sysconfig.get_config_var('prefix')} | ||
try: | ||
prefixes.add(sys.real_prefix) | ||
except AttributeError: | ||
pass | ||
form = sysconfig.get_path('purelib', expand=False) | ||
py_version_short = '{0[0]}.{0[1]}'.format(sys.version_info) | ||
return { | ||
form.format(base=prefix, py_version_short=py_version_short) | ||
for prefix in prefixes | ||
} | ||
|
||
|
||
def insert_before_site_packages(*paths): | ||
site_packages = get_site_packages() | ||
index = None | ||
for i, path in enumerate(sys.path): | ||
if path in site_packages: | ||
index = i | ||
break | ||
if index is None: | ||
sys.path += list(paths) | ||
else: | ||
sys.path = sys.path[:index] + list(paths) + sys.path[index:] | ||
|
||
|
||
def insert_pipenv_dirs(): | ||
insert_before_site_packages(os.path.dirname(PIPENV_DIR), PATCHED_DIR, VENDORED_DIR) | ||
from .cli import cli | ||
|
||
|
||
if __name__ == "__main__": # pragma: no cover | ||
insert_pipenv_dirs() | ||
yaml_lib = "pipenv.patched.yaml{0}".format(sys.version_info[0]) | ||
locals()[yaml_lib] = __import__(yaml_lib) | ||
sys.modules["yaml"] = sys.modules[yaml_lib] | ||
from pipenv.patched.safety.cli import cli | ||
cli(prog_name="safety") |
This file was deleted.
Oops, something went wrong.