psdi-data-conversion 0.1.1__py3-none-any.whl → 0.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -30,7 +30,9 @@ from psdi_data_conversion.database import get_format_info
30
30
  from psdi_data_conversion.file_io import split_archive_ext
31
31
  from psdi_data_conversion.main import print_wrap
32
32
 
33
- # Env var for the SHA of the latest commit
33
+ # Env var for the tag and SHA of the latest commit
34
+ TAG_EV = "TAG"
35
+ TAG_SHA_EV = "TAG_SHA"
34
36
  SHA_EV = "SHA"
35
37
 
36
38
  # Env var for whether this is a production release or development
@@ -134,25 +136,39 @@ def get_tag_and_sha() -> str:
134
136
  """Get the SHA of the last commit
135
137
  """
136
138
 
137
- try:
138
- # This bash command calls `git tag` to get a sorted list of tags, with the most recent at the top, then uses
139
- # `head` to trim it to one line
140
- cmd = "git tag --sort -version:refname | head -n 1"
139
+ # Get the tag of the latest commit
140
+ ev_tag = os.environ.get(TAG_EV)
141
+ if ev_tag:
142
+ tag = ev_tag
143
+ else:
144
+ try:
145
+ # This bash command calls `git tag` to get a sorted list of tags, with the most recent at the top, then uses
146
+ # `head` to trim it to one line
147
+ cmd = "git tag --sort -version:refname | head -n 1"
141
148
 
142
- out_bytes = run(cmd, shell=True, capture_output=True).stdout
143
- tag = str(out_bytes.decode()).strip()
149
+ out_bytes = run(cmd, shell=True, capture_output=True).stdout
150
+ tag = str(out_bytes.decode()).strip()
151
+
152
+ except Exception:
153
+ print("ERROR: Could not determine most recent tag. Error was:\n" + format_exc(),
154
+ file=sys.stderr)
155
+ tag = ""
144
156
 
145
- # Get the SHA associated with this tag
146
- cmd = f"git show {tag}" + " | head -n 1 | gawk '{print($2)}'"
157
+ # Get the SHA associated with this tag
158
+ ev_tag_sha = os.environ.get(TAG_SHA_EV)
159
+ if ev_tag_sha:
160
+ tag_sha: str | None = ev_tag_sha
161
+ else:
162
+ try:
163
+ cmd = f"git show {tag}" + " | head -n 1 | gawk '{print($2)}'"
147
164
 
148
- out_bytes = run(cmd, shell=True, capture_output=True).stdout
149
- tag_sha = str(out_bytes.decode()).strip()
165
+ out_bytes = run(cmd, shell=True, capture_output=True).stdout
166
+ tag_sha = str(out_bytes.decode()).strip()
150
167
 
151
- except Exception:
152
- print("ERROR: Could not determine most recent tag. Error was:\n" + format_exc(),
153
- file=sys.stderr)
154
- tag = ""
155
- tag_sha = None
168
+ except Exception:
169
+ print("ERROR: Could not determine SHA for most recent tag. Error was:\n" + format_exc(),
170
+ file=sys.stderr)
171
+ tag_sha = None
156
172
 
157
173
  # First check if the SHA is provided through an environmental variable
158
174
  ev_sha = os.environ.get(SHA_EV)
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: psdi_data_conversion
3
- Version: 0.1.1
3
+ Version: 0.1.3
4
4
  Summary: Chemistry file format conversion service, provided by PSDI
5
5
  Project-URL: Homepage, https://data-conversion.psdi.ac.uk/
6
6
  Project-URL: Documentation, https://psdi-uk.github.io/psdi-data-conversion/
@@ -1,5 +1,5 @@
1
1
  psdi_data_conversion/__init__.py,sha256=urMsTqsTHTch1q4rMT9dgGnrvdPFMP9B8r-6Kr8H5sE,404
2
- psdi_data_conversion/app.py,sha256=jU0cK3yduKQkDECf1UGJCPpBF57bUitM_YHH0vsoS4A,16745
2
+ psdi_data_conversion/app.py,sha256=RxWkfqoDDNhRH-HlZ3pW_p-EmvIxwDOspwVG5A4SD9I,17254
3
3
  psdi_data_conversion/constants.py,sha256=Hq2OVbcSkcv6T87-YJlo1PVlr9ILlB4H3E9JYjzvCF4,7423
4
4
  psdi_data_conversion/converter.py,sha256=Y77mqH2OKxf2YelphWDl82AKoRa-APle-l3e8wG_WZA,27315
5
5
  psdi_data_conversion/database.py,sha256=XzKvtT-cFmKLWLo5OBB5CV_rGHuqEEuENNyZnbS39qE,56419
@@ -81,8 +81,8 @@ psdi_data_conversion/testing/conversion_callbacks.py,sha256=ATR-_BsYCUN8KyOyUjfd
81
81
  psdi_data_conversion/testing/conversion_test_specs.py,sha256=8W97tI6dVbHE9BEW76dsKDlfsm5oTlrlntG--b0h8HU,26106
82
82
  psdi_data_conversion/testing/gui.py,sha256=ul7ixYANIzmOG2ZNOZmQO6wsHmGHdiBGAlw-KuoN0j8,19085
83
83
  psdi_data_conversion/testing/utils.py,sha256=YrFxjyiIx1seph0j7jCUgAVm6HvXY9QJjx0MvNJRbfw,26134
84
- psdi_data_conversion-0.1.1.dist-info/METADATA,sha256=M5iHWEennMs8JSqTVqyAKco-9a0a5jRWh6u5W192Ag0,48108
85
- psdi_data_conversion-0.1.1.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
86
- psdi_data_conversion-0.1.1.dist-info/entry_points.txt,sha256=xL7XTzaPRr2E67WhOD1M1Q-76hB8ausQlnNiHzuZQPA,123
87
- psdi_data_conversion-0.1.1.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
88
- psdi_data_conversion-0.1.1.dist-info/RECORD,,
84
+ psdi_data_conversion-0.1.3.dist-info/METADATA,sha256=3ny4bgYstqZKmeRZmCu3C9LiHhGuAcE9R4GkKneTl0o,48108
85
+ psdi_data_conversion-0.1.3.dist-info/WHEEL,sha256=qtCwoSJWgHk21S1Kb4ihdzI2rlJ1ZKaIurTj_ngOhyQ,87
86
+ psdi_data_conversion-0.1.3.dist-info/entry_points.txt,sha256=xL7XTzaPRr2E67WhOD1M1Q-76hB8ausQlnNiHzuZQPA,123
87
+ psdi_data_conversion-0.1.3.dist-info/licenses/LICENSE,sha256=xx0jnfkXJvxRnG63LTGOxlggYnIysveWIZ6H3PNdCrQ,11357
88
+ psdi_data_conversion-0.1.3.dist-info/RECORD,,