简体   繁体   English

如何为 Mac OS X 构建和安装 P4Python?

[英]How do I build and install P4Python for Mac OS X?

I've been unable to build P4Python for an Intel Mac OS X 10.5.5.我一直无法为 Intel Mac OS X 10.5.5 构建P4Python

These are my steps:这些是我的步骤:

  1. I downloaded p4python.tgz (from http://filehost.perforce.com/perforce/r07.3/tools/ ) and expanded it into "P4Python-2007.3".我下载了 p4python.tgz(来自http://filehost.perforce.com/perforce/r07.3/tools/ )并将其扩展为“P4Python-2007.3”。
  2. I downloaded p4api.tar (from http://filehost.perforce.com/perforce/r07.3/bin.macosx104x86/ ) and expanded it into "p4api-2007.3.143793".我下载了 p4api.tar(来自http://filehost.perforce.com/perforce/r07.3/bin.macosx104x86/ )并将其扩展为“p4api-2007.3.143793”。
  3. I placed "p4api-2007.3.143793" into "P4Python-2007.3" and edited setup.cfg to set "p4_api=./p4api-2007.3.143793".我将“p4api-2007.3.143793”放入“P4Python-2007.3”并编辑setup.cfg以设置“p4_api=./p4api-2007.3.143793”。
  4. I added the line 'extra_link_args = ["-framework", "Carbon"]' to setup.py after:我在 setup.py 之后添加了行 'extra_link_args = ["-framework", "Carbon"]' :

     elif unameOut[0] == "Darwin": unix = "MACOSX" release = "104" platform = self.architecture(unameOut[4])
  5. I ran python setup.py build and got:我运行python setup.py build并得到:

$ python setup.py build $ python setup.py 构建

API Release 2007.3
running build
running build_py
running build_ext
building 'P4API' extension
gcc -fno-strict-aliasing -Wno-long-double -no-cpp-precomp -mno-fused-madd -DNDEBUG -g -O3 -Wall -Wstrict-prototypes -DID_OS="MACOSX104X86" -DID_REL="2007.3" -DID_PATCH="151416" -DID_API="2007.3" -DID_Y="2008" -DID_M="04" -DID_D="09" -I./p4api-2007.3.143793 -I./p4api-2007.3.143793/include/p4 -I/build/toolchain/mac32/python-2.4.3/include/python2.4 -c P4API.cpp -o build/temp.darwin-9.5.0-i386-2.4/P4API.o -DOS_MACOSX -DOS_MACOSX104 -DOS_MACOSXX86 -DOS_MACOSX104X86
cc1plus: warning: command line option "-Wstrict-prototypes" is valid for C/ObjC but not for C++
P4API.cpp: In function âint P4Adapter_init(P4Adapter*, PyObject*, PyObject*)â:
P4API.cpp:105: error: âPy_ssize_tâ was not declared in this scope
P4API.cpp:105: error: expected `;' before âposâ
P4API.cpp:107: error: âposâ was not declared in this scope
P4API.cpp: In function âPyObject* P4Adapter_run(P4Adapter*, PyObject*)â:
P4API.cpp:177: error: âPy_ssize_tâ was not declared in this scope
P4API.cpp:177: error: expected `;' before âiâ
P4API.cpp:177: error: âiâ was not declared in this scope
error: command 'gcc' failed with exit status 1

which gcc returns /usr/bin/gcc and gcc -v returns: which gcc返回 /usr/bin/gcc 和gcc -v返回:

Using built-in specs.
Target: i686-apple-darwin9
Configured with: /var/tmp/gcc/gcc-5465~16/src/configure
--disable-checking -enable-werror --prefix=/usr --mandir=/share/man
--enable-languages=c,objc,c++,obj-c++
--program-transform-name=/^[cg][^.-]*$/s/$/-4.0/
--with-gxx-include-dir=/include/c++/4.0.0 --with-slibdir=/usr/lib
--build=i686-apple-darwin9 --with-arch=apple --with-tune=generic
--host=i686-apple-darwin9 --target=i686-apple-darwin9
Thread model: posix
gcc version 4.0.1 (Apple Inc. build 5465)

python -V returns Python 2.4.3. python -V返回 Python 2.4.3。

From http://bugs.mymediasystem.org/?do=details&task_id=676 suggests that Py_ssize_t was added in python 2.5, so it won't work (without some modifications) with python 2.4.http://bugs.mymediasystem.org/?do=details&task_id=676表明 Py_ssize_t 是在 python 2.5 中添加的,所以它不会在 python 2.4 中工作(没有一些修改)。

Either install/compile your own copy of python 2.5/2.6, or work out how to change P4Python, or look for an alternative python-perforce library.要么安装/编译您自己的 python 2.5/2.6 副本,要么研究如何更改 P4Python,或者寻找替代的 python-perforce 库。

The newer version 2008.1 will build with Python 2.4.较新的 2008.1 版本将使用 Python 2.4 构建。

I had posted the minor changes required to do that on my P4Python page, but they were rolled in to the official version.我已经在我的 P4Python 页面上发布了执行此操作所需的细微更改,但它们已被纳入正式版本。

Robert罗伯特

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM