Skip to content

Commit

Permalink
Correctly define environment variables. Make xml2palette script check…
Browse files Browse the repository at this point in the history
… for presence of environment variables.
  • Loading branch information
james-strauss-uwa committed Oct 8, 2021
1 parent 6668e8d commit 0bd57c0
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 6 deletions.
4 changes: 2 additions & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,8 @@ matrix:
install:
- sudo apt-get update && sudo apt-get install -y doxygen xsltproc
before_script:
- PROJECT_VERSION=$(git rev-parse --short HEAD)
- GIT_REPO=$(git config --get remote.origin.url)
- export PROJECT_VERSION=$(git rev-parse --short HEAD)
- export GIT_REPO=$(git config --get remote.origin.url)
- git config --global user.name $GITHUB_USERNAME
- git config --global user.email "$GITHUB_USERNAME@gmail.com"
script:
Expand Down
17 changes: 13 additions & 4 deletions tools/xml2palette/xml2palette.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,17 @@ def get_filenames_from_command_line(argv):
return inputdir, outputfile


# TODO
def read_environment_variables():
pass
def check_environment_variables():
required_environment_variables = ["PROJECT_VERSION", "GIT_REPO"]

for variable in required_environment_variables:
value = os.environ.get(variable)

if value is None:
logging.error("No " + variable + " environment variable.")
return False

return True


def modify_doxygen_options(doxygen_filename, options):
Expand Down Expand Up @@ -464,7 +472,8 @@ def process_compounddef(compounddef):
output_directory = tempfile.TemporaryDirectory()

# read environment variables
read_environment_variables()
if not check_environment_variables():
sys.exit(1)

# add extra doxygen setting for input and output locations
DOXYGEN_SETTINGS.append(("INPUT", inputdir))
Expand Down

0 comments on commit 0bd57c0

Please sign in to comment.