Line 0
Link Here
|
|
|
1 |
--- setup.py.orig 2018-02-02 16:50:17 UTC |
2 |
+++ setup.py |
3 |
@@ -102,7 +102,12 @@ class P4APIFtp: |
4 |
|
5 |
elif system == "FreeBSD": |
6 |
platform_str += "freebsd" |
7 |
- release = uname.release |
8 |
+ if sys.version_info.major == 3: |
9 |
+ release = uname.release |
10 |
+ elif sys.version_info.major == 2: |
11 |
+ release = uname[2] |
12 |
+ else: |
13 |
+ raise Exception("Unknown python version %s" % sys.version) |
14 |
|
15 |
value = int(''.join(itertools.takewhile(lambda s: s.isdigit(), release))) |
16 |
|
17 |
@@ -217,6 +222,8 @@ class VersionInfo: |
18 |
verFile = os.path.join(p4ApiDir, "sample", "Version") |
19 |
if not os.path.exists(verFile): |
20 |
verFile = os.path.join(p4ApiDir, "Version") |
21 |
+ if not os.path.exists(verFile): |
22 |
+ verFile = os.path.join(p4ApiDir, "share", "examples", "p4api", "Version") |
23 |
input = open(verFile) |
24 |
for line in input: |
25 |
for pattern, handler in self.patterns: |
26 |
@@ -398,9 +405,16 @@ class PlatformInfo: |
27 |
arch = self.architecture(unameOut[4]) |
28 |
elif unameOut[0] == 'FreeBSD': |
29 |
unix = "FREEBSD" |
30 |
- release = unameOut[2][0] |
31 |
- if release == '5': |
32 |
- release += unameOut[2][2] |
33 |
+ if sys.version_info.major == 3: |
34 |
+ release = unameOut.release.split(".")[0] |
35 |
+ if release == '5': |
36 |
+ release += unameOut.release.split(".")[1] |
37 |
+ elif sys.version_info.major == 2: |
38 |
+ release = unameOut[2].split(".")[0] |
39 |
+ if release == '5': |
40 |
+ release += unameOut[2].split(".")[1] |
41 |
+ else: |
42 |
+ raise Exception("Unknown python version %s" % sys.version) |
43 |
|
44 |
arch = self.architecture(unameOut[4]) |
45 |
elif unameOut[0] == 'CYGWIN_NT-5.1': |
46 |
@@ -475,8 +489,16 @@ def do_setup(p4_api_dir, ssl): |
47 |
else: |
48 |
print ("API Release %s.%s" % (ryear, rversion)) |
49 |
|
50 |
- inc_path = [p4_api_dir, os.path.join(p4_api_dir, "include", "p4")] |
51 |
- lib_path = [p4_api_dir, os.path.join(p4_api_dir, "lib")] |
52 |
+ inc_dir = os.path.join(p4_api_dir, "include", "p4") |
53 |
+ if not os.path.exists(inc_dir): |
54 |
+ inc_dir = os.path.join(p4_api_dir, "include", "perforce") |
55 |
+ |
56 |
+ lib_dir = os.path.join(p4_api_dir, "lib", "perforce") |
57 |
+ if not os.path.exists(lib_dir): |
58 |
+ lib_dir = os.path.join(p4_api_dir, "lib") |
59 |
+ |
60 |
+ inc_path = [p4_api_dir, inc_dir] |
61 |
+ lib_path = [p4_api_dir, lib_dir] |
62 |
if ssl: |
63 |
lib_path.append( ssl ) |
64 |
|
65 |
@@ -608,7 +630,7 @@ if __name__ == "__main__": |
66 |
if os.path.exists(distdir): |
67 |
shutil.rmtree(distdir, False, force_remove_file) |
68 |
|
69 |
- p4_api_dir = get_api_dir() |
70 |
+ p4_api_dir = "%%LOCALBASE%%" |
71 |
|
72 |
ssl = None |
73 |
if '--ssl' in sys.argv: |