Skip to content

Commit

Permalink
Merge pull request #45 from yaal-coop/issue-25-version
Browse files Browse the repository at this point in the history
Numéro de version statique
  • Loading branch information
klorydryk authored Oct 25, 2023
2 parents eee88d8 + 41f0365 commit a9abdf6
Show file tree
Hide file tree
Showing 5 changed files with 3 additions and 73 deletions.
44 changes: 1 addition & 43 deletions poetry.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 0 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ flask-pyoidc = "^3.14.2"
flask-sqlalchemy = "^3.0.3"
flask-uploads = "0.2.1"
flask-migrate = "3.1.0"
gitpython = "^3.1.38"
gunicorn = "20.1.0"
netaddr = "0.8.0"
sqlalchemy = "1.4.31"
Expand Down
6 changes: 1 addition & 5 deletions web/flaskr/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,18 +72,14 @@ def setup_database(app):


def setup_jinja(app):
from flaskr.utils import get_git_tag, get_git_commit

version = get_git_tag() or get_git_commit() or None

@app.context_processor
def global_processor():
return {
"config": app.config,
"beta": app.config["BETA"],
"documentation_link": app.config["DOCUMENTATION_LINK"],
"is_rie": is_rie(),
"version": version,
"version": "1.1.0",
"LANGUAGES": LANGUAGES,
**app.config["WORDINGS"],
}
Expand Down
2 changes: 1 addition & 1 deletion web/flaskr/templates/footer.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<p class="fr-footer__content-desc">
{% trans %}Le code source est ouvert et les contributions sont bienvenues.{% endtrans %}
<a title="{% trans %}Voir le code source - nouvelle fenêtre{% endtrans %}" href="https://github.com/numerique-gouv/b3desk" target="_blank" rel="noopener">{% trans %}Voir le code source{% endtrans %}</a>
{% if version %}{{ version }}{% endif %}
{% if version %}v{{ version }}{% endif %}
</p>
<ul class="fr-footer__content-list">
<li class="fr-footer__content-item">
Expand Down
23 changes: 0 additions & 23 deletions web/flaskr/utils.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
import git
from flask import current_app
from flask import request
from netaddr import IPAddress
Expand All @@ -22,25 +21,3 @@ def is_rie():
for network_ip in current_app.config.get("RIE_NETWORK_IPS", [])
if network_ip
)


def get_git_commit(): # pragma: no cover
try:
repo = git.Repo(search_parent_directories=True)
sha = repo.head.commit.hexsha
short_sha = repo.git.rev_parse(sha, short=4)
return short_sha

except git.exc.GitError:
return None


def get_git_tag(): # pragma: no cover
try:
repo = git.Repo(search_parent_directories=True)
tag = next((tag for tag in repo.tags if tag.commit == repo.head.commit), None)
if tag:
return tag.name

except git.exc.GitError:
return None

0 comments on commit a9abdf6

Please sign in to comment.