Skip to content

Commit

Permalink
Apply review suggestions
Browse files Browse the repository at this point in the history
Signed-off-by: jakub-nt <175944085+jakub-nt@users.noreply.github.com>
  • Loading branch information
jakub-nt committed Oct 24, 2024
1 parent fd85e14 commit b516b19
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 9 deletions.
10 changes: 6 additions & 4 deletions cfbs/masterfiles/analyze.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,13 @@

from cfbs.utils import dict_sorted_by_key, file_sha256

# TODO implement the ignoring
IGNORED_PATH_COMPONENTS = [".git/", ".gitignore", ".gitattributes"]
# ignore a path iff it contains a component (single file or directory) from this list
# an element of this list should be just one component
# folders should end with '/', files should not
# TODO
"""The analysis ignores paths described by this list. A path will be ignored if and only if it contains a component (a single file or directory, anywhere in the path) from this list.
Each element of this list should specify a singular component.
Folders should end with `/`, and files should not.
"""


def initialize_vcf():
Expand Down
19 changes: 14 additions & 5 deletions cfbs/masterfiles/generate_vcf_git_checkout.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
import subprocess
import sys

from cfbs.git import git_exists
from cfbs.utils import write_json
from cfbs.masterfiles.analyze import (
finalize_vcf,
Expand All @@ -18,7 +17,21 @@
MPF_PATH = os.path.join(DIR_PATH, "masterfiles")


def check_required_command(command):
if not shutil.which(command):
print("`%s` was not found" % command)
sys.exit(1)


def check_required_commands(commands):
for c in commands:
check_required_command(c)


def generate_vcf_git_checkout(interesting_tags=None):
required_commands = ["git", "make", "automake", "autoconf"]
check_required_commands(required_commands)

# clone the MPF repo every time the script is run, in case there are updates
if os.path.isdir(MPF_PATH):
shutil.rmtree(MPF_PATH)
Expand All @@ -29,10 +42,6 @@ def generate_vcf_git_checkout(interesting_tags=None):
check=True,
)

if not git_exists():
print("`git` was not found")
sys.exit(1)

result = subprocess.run(
["git", "tag"], cwd=MPF_PATH, capture_output=True, check=True
)
Expand Down

0 comments on commit b516b19

Please sign in to comment.