From 64cc0995196ff5af96d6b339d763a886714cbff0 Mon Sep 17 00:00:00 2001 From: Ahmed Bilal Khalid Date: Fri, 30 Aug 2019 15:55:10 +0500 Subject: [PATCH] a --- app/api.py | 1 + app/helper.py | 8 +++++--- 2 files changed, 6 insertions(+), 3 deletions(-) diff --git a/app/api.py b/app/api.py index d65e0d9..9502395 100644 --- a/app/api.py +++ b/app/api.py @@ -79,4 +79,5 @@ def setup( src=os.path.join(repo_name, "etcd3_wrapper"), dst=os.path.join(repo_name, "ucloud_common", "etcd3_wrapper"), ) + op.add(PipenvOperation.create, path=repo_name, site_packages=True) op.add(PipenvOperation.install, path=repo_name) diff --git a/app/helper.py b/app/helper.py index abbe800..99e0b4f 100644 --- a/app/helper.py +++ b/app/helper.py @@ -101,9 +101,9 @@ class PipenvOperation(object): @staticmethod def create(path=".", site_packages=False): if site_packages: - command = f"pipenv --site-packages --python 3.7" + command = f"pipenv --site-packages --python 3" else: - command = "pipenv --python 3.7" + command = "pipenv --python 3" try: output = subprocess.check_output(command.split(), cwd=path) except subprocess.CalledProcessError as e: @@ -116,7 +116,9 @@ class PipenvOperation(object): if package_name: command = f"pipenv install {package_name}" else: - command = f"pipenv install" + with open(os.path.join(path, "requirements.txt"), "w") as f: + subprocess.Popen("pipenv run pip freeze".split(), cwd=path, stdout=f) + command = f"pip install -r requirements.txt" try: output = subprocess.check_output(command.split(), cwd=path) except subprocess.CalledProcessError as e: