File: Initialize-__version__-with-None-if-version-info-is-unava.patch

package info (click to toggle)
gammapy 2.0-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 11,280 kB
  • sloc: python: 81,729; makefile: 228; sh: 11; javascript: 10
file content (52 lines) | stat: -rw-r--r-- 1,458 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
From: Ole Streicher <olebole@debian.org>
Date: Sun, 8 Dec 2019 20:05:03 +0100
Subject: Initialize __version__ with None if version info is unavailable

---
 gammapy/__init__.py         | 3 ++-
 gammapy/scripts/download.py | 3 ---
 gammapy/scripts/info.py     | 3 ++-
 3 files changed, 4 insertions(+), 5 deletions(-)

diff --git a/gammapy/__init__.py b/gammapy/__init__.py
index 114af9c..13f92a1 100644
--- a/gammapy/__init__.py
+++ b/gammapy/__init__.py
@@ -41,7 +41,8 @@ try:
     __version__ = version(__name__)
 except PackageNotFoundError:
     # package is not installed
-    pass
+    __version__ = None
+
 del version, PackageNotFoundError
 
 
diff --git a/gammapy/scripts/download.py b/gammapy/scripts/download.py
index b4e97f4..b796c21 100644
--- a/gammapy/scripts/download.py
+++ b/gammapy/scripts/download.py
@@ -17,9 +17,6 @@ GAMMAPY_BASE_URL = "https://gammapy.org/download/"
 
 RELEASE = __version__
 
-if "dev" in __version__:
-    RELEASE = "dev"
-
 
 class DownloadIndex:
     """Download index."""
diff --git a/gammapy/scripts/info.py b/gammapy/scripts/info.py
index 06c7fc1..27fcb8a 100644
--- a/gammapy/scripts/info.py
+++ b/gammapy/scripts/info.py
@@ -69,7 +69,8 @@ def print_info(info, title):
     info_all = f"\n{title}:\n\n"
 
     for key, value in info.items():
-        info_all += f"\t{key:22s} : {value:<10s} \n"
+        if value is not None:
+            info_all += f"\t{key:22s} : {value:<10s} \n"
 
     print(info_all)