File: dont-modify-logger.py.patch

package info (click to toggle)
input-remapper 2.1.1-2
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 2,856 kB
  • sloc: python: 27,277; sh: 191; xml: 33; makefile: 3
file content (39 lines) | stat: -rw-r--r-- 1,201 bytes parent folder | download | duplicates (2)
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
Description: Don't add the commit hash to the logs
Author: Stephen Kitt <skitt@debian.org>
Forwarded: not-needed

--- a/setup.py
+++ b/setup.py
@@ -34,18 +34,6 @@
     """Add the commit hash and build .mo translations."""
 
     def run(self):
-        try:
-            commit = os.popen("git rev-parse HEAD").read().strip()
-            if re.match(r"^([a-z]|[0-9])+$", commit):
-                # for whatever reason different systems have different paths here
-                build_dir = ""
-                if os.path.exists("build/lib/inputremapper"):
-                    build_dir = "build/lib/"
-                with open(f"{build_dir}inputremapper/commit_hash.py", "w+") as f:
-                    f.write(f"COMMIT_HASH = '{commit}'\n")
-        except Exception as e:
-            print("Failed to save the commit hash:", e)
-
         # generate .mo files
         make_lang()
 
--- a/inputremapper/logging/logger.py
+++ b/inputremapper/logging/logger.py
@@ -25,10 +25,7 @@
 
 from inputremapper.logging.formatter import ColorfulFormatter
 
-try:
-    from inputremapper.commit_hash import COMMIT_HASH
-except ImportError:
-    COMMIT_HASH = ""
+COMMIT_HASH = ""
 
 
 start = time.time()