File: configuration_files_in_etc_and_per_user.patch

package info (click to toggle)
sepp 4.5.5%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: sid
  • size: 33,376 kB
  • sloc: python: 5,635; java: 4,698; sh: 2,203; makefile: 53; xml: 31
file content (56 lines) | stat: -rw-r--r-- 1,882 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
53
54
55
56
Description: using configuration files that are in /etc or in ~/.sepp
Author: Pierre Gruet <pgt@debian.org>
Forwarded: not-needed
Last-Update: 2020-10-08

--- a/sepp/config.py
+++ b/sepp/config.py
@@ -49,11 +49,11 @@
 
 _LOG = get_logger(__name__)
 
-root_p = open(os.path.join(os.path.split(
-    os.path.split(__file__)[0])[0], "home.path")).readlines()[0].strip()
-print("root_p='%s'" % root_p)
-main_config_path = os.path.join(root_p, "main.config")
-
+home = os.path.expanduser("~")
+if os.path.isfile(home + "/.sepp/sepp.config"):
+    main_config_path = home + "/.sepp/sepp.config"
+else:
+    main_config_path = "/etc/sepp/sepp.config"
 
 def set_main_config_path(filename):
     global main_config_path
--- a/sepp/ensemble.py
+++ b/sepp/ensemble.py
@@ -163,7 +163,11 @@
 
 
 def augment_parser():
-    sepp.config.set_main_config_path(os.path.expanduser("~/.sepp/upp.config"))
+    home = os.path.expanduser("~")
+    if os.path.isfile(home + "/.sepp/upp.config"):
+        sepp.config.set_main_config_path(home + "/.sepp/upp.config")
+    else:
+        sepp.config.set_main_config_path("/etc/sepp/upp.config")
     parser = sepp.config.get_parser()
     parser.description = (
         "This script runs the UPP algorithm on set of sequences.  A backbone "
--- a/sepp/exhaustive_upp.py
+++ b/sepp/exhaustive_upp.py
@@ -382,9 +382,11 @@
 
 
 def augment_parser():
-    root_p = open(os.path.join(os.path.split(
-        os.path.split(__file__)[0])[0], "home.path")).readlines()[0].strip()
-    upp_config_path = os.path.join(root_p, "upp.config")
+    home = os.path.expanduser("~")
+    if os.path.isfile(home + "/.sepp/upp.config"):
+        upp_config_path = home + "/.sepp/upp.config"
+    else:
+        upp_config_path = "/etc/sepp/upp.config"
     sepp.config.set_main_config_path(upp_config_path)
     parser = sepp.config.get_parser()
     parser.description = (