View | Details | Raw Unified | Return to bug 219407
Collapse All | Expand All

(-)head/devel/py-p4python/Makefile (+24 lines)
Line 0 Link Here
1
# $FreeBSD$
2
3
PORTNAME=	p4python
4
PORTVERSION=	2016.1.1447008
5
CATEGORIES=	devel python
6
MASTER_SITES=	CHEESESHOP
7
PKGNAMEPREFIX=	${PYTHON_PKGNAMEPREFIX}
8
9
MAINTAINER=	asomers@FreeBSD.org
10
COMMENT=	Python bindings for the Perforce API
11
12
LICENSE=	BSD2CLAUSE
13
LICENSE_FILE=	${WRKSRC}/LICENSE.txt
14
15
BUILD_DEPENDS+=	${LOCALBASE}/lib/perforce/libclient.a:devel/p4api
16
RUN_DEPENDS:=	${BUILD_DEPENDS}
17
18
USES=		dos2unix python
19
USE_PYTHON=	distutils autoplist
20
21
post-patch:
22
	@${REINPLACE_CMD} -e 's:%%LOCALBASE%%:${LOCALBASE}:' ${WRKSRC}/setup.py
23
24
.include <bsd.port.mk>
(-)head/devel/py-p4python/distinfo (+3 lines)
Line 0 Link Here
1
TIMESTAMP = 1517419395
2
SHA256 (p4python-2016.1.1447008.tar.gz) = 1907f3c7ace54763651c1ccf20b92e6e9e72de58b240c591d6291ebb24ef0f1b
3
SIZE (p4python-2016.1.1447008.tar.gz) = 84231
(-)head/devel/py-p4python/files/patch-setup.py (+73 lines)
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:
(-)head/devel/py-p4python/pkg-descr (+4 lines)
Line 0 Link Here
1
The Python bindings for the Perforce Client API provide convenient classes
2
within Python for communicating with Perforce SCM servers.
3
4
WWW: https://www.perforce.com/perforce/doc.current/manuals/p4script/03_python.html

Return to bug 219407