Skip to content

Commit

Permalink
Merge pull request #2168 from SasView/2164-update-config-from-list-of…
Browse files Browse the repository at this point in the history
…-variables-to-class

2164 update config from list of variables to class
  • Loading branch information
lucas-wilkins authored Oct 14, 2022
2 parents 8d1020a + cb5c058 commit 28a9005
Show file tree
Hide file tree
Showing 62 changed files with 1,328 additions and 1,823 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/docs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ jobs:
run: |
# SET SASVIEW GITHASH
githash=$( git rev-parse HEAD )
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/sasview/__init__.py
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/system/version.py
# BUILD SASVIEW
python setup.py clean
python setup.py build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/installers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -150,7 +150,7 @@ jobs:
run: |
# SET SASVIEW GITHASH
githash=$( git rev-parse HEAD )
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/sasview/__init__.py
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/system/version.py
# BUILD SASVIEW
python setup.py clean
python setup.py build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ jobs:
run: |
# SET SASVIEW GITHASH
githash=$( git rev-parse HEAD )
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/sasview/__init__.py
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/system/version.py
# BUILD SASVIEW
python setup.py clean
python setup.py build
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ jobs:
run: |
# SET SASVIEW GITHASH
githash=$( git rev-parse HEAD )
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/sasview/__init__.py
sed -i.bak s/GIT_COMMIT/$githash/g src/sas/system/version.py
# BUILD SASVIEW
python setup.py clean
python setup.py build
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,6 @@
*.so
*.exe

/.vagrant
/build
/dist
sasview.egg-info
Expand All @@ -39,6 +38,7 @@ default_categories.json
/setup.cfg
**/UI/*.py
!**/UI/__init__.py
config.json

# doc build
/docs/sphinx-docs/build
Expand Down
38 changes: 20 additions & 18 deletions build_tools/release_automation.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,29 +135,31 @@ def generate_zenodo(sasview_data, zenodo_api_key):
"and attach to Zenodo release record.\n- Publish Zenodo record")
return newDOI

def update_sasview_init(version, doi):
"""
version_template = \
"""
__version__ = "%s"
__release_date__ = "%i"
__build__ = "GIT_COMMIT"
"""

:return:
zenodo_template = '__DOI__ = "%s"'

def update_sasview_metadata(version, doi):
"""
Update version and zenodo DOI
"""

init_file = os.path.join('sasview','src', 'sas', 'sasview', '__init__.py')
output_lines = []
system_directory = "sasview/src/sas/system"
version_filename = os.path.join(system_directory, "version.py")
zenodo_filename = os.path.join(system_directory, "zenodo.py")

year = datetime.datetime.now().year
with open(init_file, 'r') as f:
for line in f.readlines():
if line[:11] in '__version__':
output_lines.append('__version__ = \"'+version+'\"\n')
elif line[:7] in '__DOI__' :
output_lines.append('__DOI__ = \"Zenodo, ' + str(doi) + '\"\n')
elif line[:16] in '__release_date__':
output_lines.append('__release_date__ = \"' + str(year) + '\"\n')
else:
output_lines.append(line)

with open(init_file, 'w') as f:
f.writelines(output_lines)
with open(version_filename, 'w') as file:
file.write(version_template % (version, year))

with open(zenodo_filename, 'w') as file:
file.write(zenodo_template % doi)

def update_sasmodels_init(version):
"""
Expand Down Expand Up @@ -241,7 +243,7 @@ def prepare_release_notes(issues_list, repository, username, password):
zenodo_api_key = args.zenodo
new_doi = generate_zenodo(sasview_data, zenodo_api_key)

update_sasview_init(sasview_version, new_doi)
update_sasview_metadata(sasview_version, new_doi)
update_sasmodels_init(sasmodels_version)

year = datetime.datetime.now().year
Expand Down
1 change: 1 addition & 0 deletions build_tools/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,4 @@ html5lib
importlib-resources
bumps
html2text
jsonschema
1 change: 0 additions & 1 deletion docs/sphinx-docs/source/_extensions/mathjax.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ def setup(app):
app.add_config_value('mathjax_path',
'https://cdnjs.cloudflare.com/ajax/libs/mathjax/2.7.1/MathJax.js?'
'config=TeX-MML-AM_CHTML',
#'config=TeX-AMS-MML_HTMLorMML',
False)
app.add_config_value('mathjax_css', None, 'html')
app.add_config_value('mathjax_use_katex', False, 'html')
Expand Down
Loading

0 comments on commit 28a9005

Please sign in to comment.