forked from cerc-io/stack-orchestrator
Fix shiv package
This commit is contained in:
parent
5a69bf471b
commit
1a5844af7a
@ -25,6 +25,7 @@ import sys
|
|||||||
from decouple import config
|
from decouple import config
|
||||||
import subprocess
|
import subprocess
|
||||||
import click
|
import click
|
||||||
|
import pkg_resources
|
||||||
from .util import include_exclude_check
|
from .util import include_exclude_check
|
||||||
|
|
||||||
# TODO: find a place for this
|
# TODO: find a place for this
|
||||||
@ -55,8 +56,8 @@ def command(ctx, include, exclude):
|
|||||||
if not os.path.isdir(dev_root_path):
|
if not os.path.isdir(dev_root_path):
|
||||||
print('Dev root directory doesn\'t exist, creating')
|
print('Dev root directory doesn\'t exist, creating')
|
||||||
|
|
||||||
with open("data/container-image-list.txt") as container_list_file:
|
with pkg_resources.resource_stream(__name__, "data/container-image-list.txt") as container_list_file:
|
||||||
containers = container_list_file.read().splitlines()
|
containers = container_list_file.read().decode().splitlines()
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f'Containers: {containers}')
|
print(f'Containers: {containers}')
|
||||||
|
@ -20,6 +20,7 @@ import os
|
|||||||
import sys
|
import sys
|
||||||
from python_on_whales import DockerClient
|
from python_on_whales import DockerClient
|
||||||
import click
|
import click
|
||||||
|
import pkg_resources
|
||||||
from .util import include_exclude_check
|
from .util import include_exclude_check
|
||||||
|
|
||||||
|
|
||||||
@ -48,11 +49,11 @@ def command(ctx, include, exclude, cluster, command, services):
|
|||||||
if verbose:
|
if verbose:
|
||||||
print(f"Using cluster name: {cluster}")
|
print(f"Using cluster name: {cluster}")
|
||||||
|
|
||||||
with open("data/pod-list.txt") as pod_list_file:
|
with pkg_resources.resource_stream(__name__, "data/pod-list.txt") as pod_list_file:
|
||||||
pods = pod_list_file.read().splitlines()
|
pods = pod_list_file.read().decode().splitlines()
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f'Pods: {pods}')
|
print(f"Pods: {pods}")
|
||||||
|
|
||||||
# Construct a docker compose command suitable for our purpose
|
# Construct a docker compose command suitable for our purpose
|
||||||
|
|
||||||
|
@ -22,6 +22,7 @@ from decouple import config
|
|||||||
import git
|
import git
|
||||||
from tqdm import tqdm
|
from tqdm import tqdm
|
||||||
import click
|
import click
|
||||||
|
import pkg_resources
|
||||||
from .util import include_exclude_check
|
from .util import include_exclude_check
|
||||||
|
|
||||||
|
|
||||||
@ -77,23 +78,23 @@ def command(ctx, include, exclude, check_only, pull, branches_file):
|
|||||||
|
|
||||||
if local_stack:
|
if local_stack:
|
||||||
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")]
|
dev_root_path = os.getcwd()[0:os.getcwd().rindex("stack-orchestrator")]
|
||||||
print(f'Local stack dev_root_path (CERC_REPO_BASE_DIR) overridden to: {dev_root_path}')
|
print(f"Local stack dev_root_path (CERC_REPO_BASE_DIR) overridden to: {dev_root_path}")
|
||||||
else:
|
else:
|
||||||
dev_root_path = os.path.expanduser(config("CERC_REPO_BASE_DIR", default="~/cerc"))
|
dev_root_path = os.path.expanduser(config("CERC_REPO_BASE_DIR", default="~/cerc"))
|
||||||
|
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print(f'Dev Root is: {dev_root_path}')
|
print(f"Dev Root is: {dev_root_path}")
|
||||||
|
|
||||||
if not os.path.isdir(dev_root_path):
|
if not os.path.isdir(dev_root_path):
|
||||||
if not quiet:
|
if not quiet:
|
||||||
print('Dev root directory doesn\'t exist, creating')
|
print('Dev root directory doesn\'t exist, creating')
|
||||||
os.makedirs(dev_root_path)
|
os.makedirs(dev_root_path)
|
||||||
|
|
||||||
with open("data/repository-list.txt") as repository_list_file:
|
with pkg_resources.resource_stream(__name__, "data/repository-list.txt") as repository_list_file:
|
||||||
all_repos = repository_list_file.read().splitlines()
|
all_repos = repository_list_file.read().decode().splitlines()
|
||||||
|
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f'Repos: {all_repos}')
|
print(f"Repos: {all_repos}")
|
||||||
|
|
||||||
repos = []
|
repos = []
|
||||||
for repo in all_repos:
|
for repo in all_repos:
|
||||||
@ -104,23 +105,23 @@ def command(ctx, include, exclude, check_only, pull, branches_file):
|
|||||||
print(f"Excluding: {repo}")
|
print(f"Excluding: {repo}")
|
||||||
|
|
||||||
def process_repo(repo):
|
def process_repo(repo):
|
||||||
full_github_repo_path = f'git@github.com:{repo}'
|
full_github_repo_path = f"git@github.com:{repo}"
|
||||||
repoName = repo.split("/")[-1]
|
repoName = repo.split("/")[-1]
|
||||||
full_filesystem_repo_path = os.path.join(dev_root_path, repoName)
|
full_filesystem_repo_path = os.path.join(dev_root_path, repoName)
|
||||||
is_present = os.path.isdir(full_filesystem_repo_path)
|
is_present = os.path.isdir(full_filesystem_repo_path)
|
||||||
if not quiet:
|
if not quiet:
|
||||||
present_text = f'already exists active branch: {git.Repo(full_filesystem_repo_path).active_branch}' if is_present \
|
present_text = f"already exists active branch: {git.Repo(full_filesystem_repo_path).active_branch}" if is_present \
|
||||||
else 'Needs to be fetched'
|
else 'Needs to be fetched'
|
||||||
print(f'Checking: {full_filesystem_repo_path}: {present_text}')
|
print(f"Checking: {full_filesystem_repo_path}: {present_text}")
|
||||||
# Quick check that it's actually a repo
|
# Quick check that it's actually a repo
|
||||||
if is_present:
|
if is_present:
|
||||||
if not is_git_repo(full_filesystem_repo_path):
|
if not is_git_repo(full_filesystem_repo_path):
|
||||||
print(f'Error: {full_filesystem_repo_path} does not contain a valid git repository')
|
print(f"Error: {full_filesystem_repo_path} does not contain a valid git repository")
|
||||||
sys.exit(1)
|
sys.exit(1)
|
||||||
else:
|
else:
|
||||||
if pull:
|
if pull:
|
||||||
if verbose:
|
if verbose:
|
||||||
print(f'Running git pull for {full_filesystem_repo_path}')
|
print(f"Running git pull for {full_filesystem_repo_path}")
|
||||||
if not check_only:
|
if not check_only:
|
||||||
git_repo = git.Repo(full_filesystem_repo_path)
|
git_repo = git.Repo(full_filesystem_repo_path)
|
||||||
origin = git_repo.remotes.origin
|
origin = git_repo.remotes.origin
|
||||||
|
2
setup.py
2
setup.py
@ -18,6 +18,8 @@ setup(
|
|||||||
packages=find_packages(),
|
packages=find_packages(),
|
||||||
install_requires=[requirements],
|
install_requires=[requirements],
|
||||||
python_requires='>=3.7',
|
python_requires='>=3.7',
|
||||||
|
include_package_data=True,
|
||||||
|
package_data={'': ['data/*.txt']},
|
||||||
classifiers=[
|
classifiers=[
|
||||||
"Programming Language :: Python :: 3.8",
|
"Programming Language :: Python :: 3.8",
|
||||||
"Operating System :: OS Independent",
|
"Operating System :: OS Independent",
|
||||||
|
Loading…
Reference in New Issue
Block a user