From b5df703f6074cf42ed546b9aa753e90126741320 Mon Sep 17 00:00:00 2001 From: David Boreham Date: Tue, 23 Aug 2022 15:58:32 -0600 Subject: [PATCH] Add copyright --- app/build-containers.py | 15 +++++++ app/deploy-system.py | 15 +++++++ app/setup-repositories.py | 15 +++++++ pip-stuff.sh | 6 --- setup-repositories.py | 94 --------------------------------------- 5 files changed, 45 insertions(+), 100 deletions(-) delete mode 100644 pip-stuff.sh delete mode 100644 setup-repositories.py diff --git a/app/build-containers.py b/app/build-containers.py index 3b8e398..fac5e14 100644 --- a/app/build-containers.py +++ b/app/build-containers.py @@ -1,3 +1,18 @@ +# Copyright © 2022 Cerc + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + # Builds or pulls containers for the system components # env vars: diff --git a/app/deploy-system.py b/app/deploy-system.py index c7995d9..a80c7b2 100644 --- a/app/deploy-system.py +++ b/app/deploy-system.py @@ -1,3 +1,18 @@ +# Copyright © 2022 Cerc + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + # Deploys the system components using docker-compose import os diff --git a/app/setup-repositories.py b/app/setup-repositories.py index 5b2c90d..9623b4e 100644 --- a/app/setup-repositories.py +++ b/app/setup-repositories.py @@ -1,3 +1,18 @@ +# Copyright © 2022 Cerc + +# This program is free software: you can redistribute it and/or modify +# it under the terms of the GNU Affero General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. + +# This program is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Affero General Public License for more details. + +# You should have received a copy of the GNU Affero General Public License +# along with this program. If not, see . + # env vars: # VULCANIZE_REPO_BASE_DIR defaults to ~/vulcanize diff --git a/pip-stuff.sh b/pip-stuff.sh deleted file mode 100644 index 4d500af..0000000 --- a/pip-stuff.sh +++ /dev/null @@ -1,6 +0,0 @@ -pip install testcontainers -python -m pip install --upgrade pip -pip install python-decouple -pip install gitpython -pip install tqdm -pip install python-on-whales diff --git a/setup-repositories.py b/setup-repositories.py deleted file mode 100644 index 5b2c90d..0000000 --- a/setup-repositories.py +++ /dev/null @@ -1,94 +0,0 @@ -# env vars: -# VULCANIZE_REPO_BASE_DIR defaults to ~/vulcanize - -import os -import sys -import argparse -from decouple import config -import git -from tqdm import tqdm - -class GitProgress(git.RemoteProgress): - def __init__(self): - super().__init__() - self.pbar = tqdm(unit = 'B', ascii = True, unit_scale = True) - - def update(self, op_code, cur_count, max_count=None, message=''): - self.pbar.total = max_count - self.pbar.n = cur_count - self.pbar.refresh() - -def is_git_repo(path): - try: - _ = git.Repo(path).git_dir - return True - except git.exc.InvalidGitRepositoryError: - return False - -parser = argparse.ArgumentParser( - description="git clone the set of repositories required to build the complete system from source", - epilog="Config provided either in .env or settings.ini or env vars: VULCANIZE_REPO_BASE_DIR (defaults to ~/vulcanize)" - ) -parser.add_argument("--verbose", action="store_true", help="increase output verbosity") -parser.add_argument("--quiet", action="store_true", help="don\'t print informational output") -parser.add_argument("--check-only", action="store_true", help="looks at what\'s already there and checks if it looks good") -parser.add_argument("--dry-run", action="store_true", help="don\'t do anything, just print the commands that would be executed") -parser.add_argument("--pull", action="store_true", help="pull from remote in already existing repositories") - -args = parser.parse_args() - -verbose = args.verbose -quiet = args.quiet - -dev_root_path = os.path.expanduser(config("DEV_ROOT", default="~/vulcanize")) - -if not args.quiet: - print(f'Dev Root is: {dev_root_path}') - -if not os.path.isdir(dev_root_path): - if not quiet: - print(f'Dev root directory doesn\'t exist, creating') - os.makedirs(dev_root_path) - -with open("repository-list.txt") as repository_list_file: - repos = repository_list_file.read().splitlines() - -if verbose: - print (f'Repos: {repos}') - -def process_repo(repo): - full_github_repo_path = f'git@github.com:{repo}' - repoName = repo.split("/")[-1] - full_filesystem_repo_path = os.path.join(dev_root_path, repoName) - is_present = os.path.isdir(full_filesystem_repo_path) - if not quiet: - present_text = f'already exists active branch: {git.Repo(full_filesystem_repo_path).active_branch}' if is_present else 'Needs to be fetched' - print(f'Checking: {full_filesystem_repo_path}: {present_text}') - # Quick check that it's actually a repo - if is_present: - if not is_git_repo(full_filesystem_repo_path): - print(f'Error: {full_filesystem_repo_path} does not contain a valid git repository') - sys.exit(1) - else: - if args.pull: - if verbose: - print(f'Running git pull for {full_filesystem_repo_path}') - if not args.check_only: - repo = git.Repo(full_filesystem_repo_path) - origin = repo.remotes.origin - origin.pull(progress = None if quiet else GitProgress()) - else: - print("(git pull skipped)") - if not is_present: - # Clone - if verbose: - print(f'Running git clone for {full_github_repo_path} into {full_filesystem_repo_path}') - if not args.check_only: - git.Repo.clone_from(full_github_repo_path, full_filesystem_repo_path, - progress = None if quiet else GitProgress()) - else: - print("(git clone skipped)") - - -for repo in repos: - process_repo(repo)