···
1
-
diff --git a/onionshare/common.py b/onionshare/common.py
2
-
index 3373462..7fd245b 100644
3
-
--- a/onionshare/common.py
4
-
+++ b/onionshare/common.py
5
-
@@ -87,66 +87,16 @@ class Common(object):
9
-
- if not os.path.exists(prefix):
10
-
- # While running tests during stdeb bdist_deb, look 3 directories up for the share folder
11
-
- prefix = os.path.join(
13
-
- os.path.dirname(os.path.dirname(os.path.dirname(prefix)))
18
-
- elif self.platform == "BSD" or self.platform == "Linux":
19
-
- # Assume OnionShare is installed systemwide in Linux, since we're not running in dev mode
20
-
- prefix = os.path.join(sys.prefix, "share/onionshare")
22
-
- elif getattr(sys, "frozen", False):
23
-
- # Check if app is "frozen"
24
-
- # https://pythonhosted.org/PyInstaller/#run-time-information
25
-
- if self.platform == "Darwin":
26
-
- prefix = os.path.join(sys._MEIPASS, "share")
27
-
- elif self.platform == "Windows":
28
-
- prefix = os.path.join(os.path.dirname(sys.executable), "share")
30
-
+ prefix = "@common@/share/onionshare"
32
-
return os.path.join(prefix, filename)
1
+
--- a/onionshare_cli/common.py
2
+
+++ b/onionshare_cli/common.py
3
+
@@ -86,33 +86,10 @@ class Common:
- if self.platform == "Linux":
36
-
- tor_path = "/usr/bin/tor"
37
-
- tor_geo_ip_file_path = "/usr/share/tor/geoip"
38
-
- tor_geo_ipv6_file_path = "/usr/share/tor/geoip6"
39
-
- obfs4proxy_file_path = "/usr/bin/obfs4proxy"
8
+
- tor_path = shutil.which("tor")
10
+
- raise CannotFindTor()
11
+
- obfs4proxy_file_path = shutil.which("obfs4proxy")
12
+
- prefix = os.path.dirname(os.path.dirname(tor_path))
13
+
- tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
14
+
- tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
- elif self.platform == "Windows":
41
-
- base_path = os.path.join(
42
-
- os.path.dirname(os.path.dirname(self.get_resource_path(""))), "tor"
44
-
- tor_path = os.path.join(os.path.join(base_path, "Tor"), "tor.exe")
45
-
- obfs4proxy_file_path = os.path.join(
46
-
- os.path.join(base_path, "Tor"), "obfs4proxy.exe"
48
-
- tor_geo_ip_file_path = os.path.join(
49
-
- os.path.join(os.path.join(base_path, "Data"), "Tor"), "geoip"
51
-
- tor_geo_ipv6_file_path = os.path.join(
52
-
- os.path.join(os.path.join(base_path, "Data"), "Tor"), "geoip6"
16
+
- base_path = self.get_resource_path("tor")
17
+
- tor_path = os.path.join(base_path, "Tor", "tor.exe")
18
+
- obfs4proxy_file_path = os.path.join(base_path, "Tor", "obfs4proxy.exe")
19
+
- tor_geo_ip_file_path = os.path.join(base_path, "Data", "Tor", "geoip")
20
+
- tor_geo_ipv6_file_path = os.path.join(base_path, "Data", "Tor", "geoip6")
- elif self.platform == "Darwin":
55
-
- base_path = os.path.dirname(
56
-
- os.path.dirname(os.path.dirname(self.get_resource_path("")))
58
-
- tor_path = os.path.join(base_path, "Resources", "Tor", "tor")
59
-
- tor_geo_ip_file_path = os.path.join(base_path, "Resources", "Tor", "geoip")
60
-
- tor_geo_ipv6_file_path = os.path.join(
61
-
- base_path, "Resources", "Tor", "geoip6"
63
-
- obfs4proxy_file_path = os.path.join(
64
-
- base_path, "Resources", "Tor", "obfs4proxy"
22
+
- tor_path = shutil.which("tor")
24
+
- raise CannotFindTor()
25
+
- obfs4proxy_file_path = shutil.which("obfs4proxy")
26
+
- prefix = os.path.dirname(os.path.dirname(tor_path))
27
+
- tor_geo_ip_file_path = os.path.join(prefix, "share/tor/geoip")
28
+
- tor_geo_ipv6_file_path = os.path.join(prefix, "share/tor/geoip6")
- elif self.platform == "BSD":
- tor_path = "/usr/local/bin/tor"
- tor_geo_ip_file_path = "/usr/local/share/tor/geoip"
···
+ tor_geo_ip_file_path = "@geoip@/share/tor/geoip"
+ tor_geo_ipv6_file_path = "@geoip@/share/tor/geoip6"
+ obfs4proxy_file_path = "@obfs4@/bin/obfs4proxy"
78
-
diff --git a/setup.py b/setup.py
79
-
index 9af72fc..53ca47b 100644
82
-
@@ -70,41 +70,41 @@ classifiers = [
86
-
- os.path.join(sys.prefix, "share/applications"),
87
-
+ "share/applications",
88
-
["install/org.onionshare.OnionShare.desktop"],
91
-
- os.path.join(sys.prefix, "share/icons/hicolor/scalable/apps"),
92
-
+ "share/icons/hicolor/scalable/apps",
93
-
["install/org.onionshare.OnionShare.svg"],
96
-
- os.path.join(sys.prefix, "share/metainfo"),
98
-
["install/org.onionshare.OnionShare.appdata.xml"],
100
-
- (os.path.join(sys.prefix, "share/onionshare"), file_list("share")),
101
-
- (os.path.join(sys.prefix, "share/onionshare/images"), file_list("share/images")),
102
-
- (os.path.join(sys.prefix, "share/onionshare/locale"), file_list("share/locale")),
103
-
+ ( "share/onionshare", file_list("share")),
104
-
+ ( "share/onionshare/images", file_list("share/images")),
105
-
+ ( "share/onionshare/locale", file_list("share/locale")),
107
-
- os.path.join(sys.prefix, "share/onionshare/templates"),
108
-
+ "share/onionshare/templates",
109
-
file_list("share/templates"),
112
-
- os.path.join(sys.prefix, "share/onionshare/static/css"),
113
-
+ "share/onionshare/static/css",
114
-
file_list("share/static/css"),
117
-
- os.path.join(sys.prefix, "share/onionshare/static/img"),
118
-
+ "share/onionshare/static/img",
119
-
file_list("share/static/img"),
122
-
- os.path.join(sys.prefix, "share/onionshare/static/js"),
123
-
+ "share/onionshare/static/js",
124
-
file_list("share/static/js"),
127
-
if not platform.system().endswith("BSD") and platform.system() != "DragonFly":
130
-
- "/usr/share/nautilus-python/extensions/",
131
-
+ "share/nautilus-python/extensions/",
132
-
["install/scripts/onionshare-nautilus.py"],