Mac OS X用のP4Pythonをビルドしてインストールするにはどうすればよいですか?

StackOverflow https://stackoverflow.com/questions/168273

質問

Intel Mac OS用の P4Python をビルドできませんでしたX 10.5.5。

これらは私のステップです:

  1. p4python.tgzをダウンロードしました(から http://filehost.perforce.com/perforce/r07.3/tools/ )および展開 それを" 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&quot ;," Carbon"]' 後のsetup.py:

    elif unameOut[0] == "Darwin":
        unix = "MACOSX"
        release = "104"
        platform = self.architecture(unameOut[4])
    
  5. python setup.py build を実行して次のコードを取得しました:

$ 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 は/ 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を返します。

役に立ちましたか?

解決

新しいバージョン2008.1はPython 2.4でビルドされます。

それを行うために必要なマイナーな変更をP4Pythonページに投稿しましたが、それらは公式バージョンにロールインされました。

ロバート

他のヒント

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ライブラリを探します。

ライセンス: CC-BY-SA帰属
所属していません StackOverflow
scroll top