Skip to content

Commit 6e26436

Browse files
authored
Fixes None from get_version() (#179)
Handle None from get_pkg_version Adding confirmation to upload_static_assets.py ARXIVNG-3008
1 parent d33bf9f commit 6e26436

File tree

4 files changed

+72
-58
lines changed

4 files changed

+72
-58
lines changed

Pipfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ sphinxcontrib-websupport = "*"
2929
sphinx-autodoc-typehints = "==1.8.0"
3030
astroid = "<2.2"
3131
mypy-extensions = "==0.4.2"
32+
click = "*"
3233

3334
[pipenv]
3435
allow_prereleases = true

Pipfile.lock

Lines changed: 59 additions & 52 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

arxiv/release/dist_version.py

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -44,10 +44,11 @@ def get_version(dist_name: str) -> Optional[str]:
4444
return dist_version
4545
except ModuleNotFoundError:
4646
pass
47-
try:
48-
return get_pkg_version(dist_name)
49-
except Exception:
50-
pass
47+
48+
pkv=get_pkg_version(dist_name)
49+
if pkv is not None:
50+
return pkv
51+
5152
try:
5253
return get_git_version()
5354
except ValueError:
@@ -97,7 +98,7 @@ def get_pkg_version(pkg: Any) -> Optional[str]:
9798
"""
9899
try:
99100
return pkg_resources.get_distribution(pkg).version
100-
except Exception:
101+
except:
101102
return None
102103

103104

upload_static_assets.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,13 @@
11
"""Use this to upload static content to S3."""
22

3+
import click
34
import flask_s3
45
from arxiv.base.factory import create_web_app
56

67
app = create_web_app()
78
with app.app_context():
8-
flask_s3.create_all(app)
9+
sup = app.static_url_path
10+
if click.confirm(f'Upload static assets for {sup} to public S3 bucket at {app.config.get("FLASKS3_BUCKET_NAME")}?', default=True):
11+
flask_s3.create_all(app)
12+
else:
13+
print("Aborted.")

0 commit comments

Comments
 (0)