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

发布于 2024-07-07 18:48:12 字数 2922 浏览 10 评论 0原文

我无法为 Intel Mac OS X 10.5 构建 P4Python。 5.

这些是我的步骤:

  1. 我下载了 p4python.tgz (来自 http://filehost.perforce.com/perforce/r07.3/tools/< /a>) 并展开 它进入“P4Python-2007.3”。
  2. 我下载了 p4api.tar(来自 http://filehost.perforce.com/perforce/r07.3/bin .macosx104x86/) 并将其扩展为“p4api-2007.3.143793”。
  3. 我将“p4api-2007.3.143793”放入“P4Python-2007.3”并编辑 setup.cfg 设置“p4_api=./p4api-2007.3.143793”。
  4. 我添加了行 'extra_link_args = ["-framework", "Carbon"]' setup.py 之后:

    elif unameOut[0] == "达尔文": 
          unix =“MACOSX” 
          释放=“104” 
          平台 = self.architecture(unameOut[4]) 
      
  5. 我运行了 python setup.py build 并得到:

$ python setup.py py build

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 返回 /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 返回 Python 2.4.3。

I've been unable to build P4Python for an Intel Mac OS X 10.5.5.

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".
  2. I downloaded p4api.tar (from
    http://filehost.perforce.com/perforce/r07.3/bin.macosx104x86/)
    and expanded it into "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".
  4. I added the line 'extra_link_args = ["-framework", "Carbon"]' to
    setup.py after:

    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

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:

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.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

流殇 2024-07-14 18:48:12

新版本 2008.1 将使用 Python 2.4 构建。

我已经在我的 P4Python 页面上发布了执行此操作所需的微小更改,但它们已包含在正式版本中。

罗伯特

The newer version 2008.1 will build with 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.

Robert

星軌x 2024-07-14 18:48:12

来自 http://bugs.mymediasystem.org/?do=details&task_id=676 表明 Py_ssize_t 是在 python 2.5 中添加的,因此它无法在 python 2.4 中工作(无需进行一些修改)。

安装/编译您自己的 python 2.5/2.6 副本,或者研究如何更改 P4Python,或者寻找替代的 python-perforce 库。

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.

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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文