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.

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.


Asked by: Melissa358 | Posted: 24-09-2021






Answer 1

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

Answered by: Miranda255 | Posted: 25-10-2021



Answer 2

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.

Answered by: Cherry530 | Posted: 25-10-2021



Answer 3

Very outdated, but maybe you can use http://public.perforce.com:8080/@md=d&cd=//guest/miki_tebeka/p4py/&c=5Fm@//guest/miki_tebeka/p4py/main/?ac=83 for now

Answered by: Emily827 | Posted: 25-10-2021



Similar questions

python - Not able to install p4python

I'm trying to install p4python on a freebsd which runs python 2.7.5. Im getting the following error. Using cached p4python-2016.1.1447008.tar.gz Complete output from command python setup.py egg_info: Attempting to load API from ftp.perforce.com Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-WK9yDa/p4python/setup.py", line 611,...


python - Not able to install p4python

I'm trying to install p4python on a freebsd which runs python 2.7.5. Im getting the following error. Using cached p4python-2016.1.1447008.tar.gz Complete output from command python setup.py egg_info: Attempting to load API from ftp.perforce.com Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-WK9yDa/p4python/setup.py", line 611,...


python - How to get the type of change in P4Python

I'm trying to work with P4Python, and hoping to find a way to be able to check what's the type of change of each file in the changelist. I mean, I'd like to know if it's a modification, or whether this file has Marked for Add or Marked for Delete. My code is something like p4.connect() clientSpec = p4.fetch_client() depotList = p4.run_opened("-c", change...


p4python - Not able to use p4 module in python

I am using ubuntu 12.04 64 bit and i have installed p4python in it.. I tried to import p4 module but it is giving me below error import p4 Traceback (most recent call last): File "", line 1, in ImportError: No module named p4 Can someone please help me??


python - how to get all change numbers from sync - p4python

I periodically get a p4 sync and want to know what actually got synced. So I get the return from p4.run_sync which is a list of dicts per change (as far as I understood) sync = p4.run_sync() when I print the keys it looks like that: sync dict Nr: 0 -------------- * totalFileSize * rev * totalFileCount * clientFile * fileSize * action * depotFile * change sync d...


p4python - import P4API fails on win 64, python 3.5.1

I'm getting the following error when running import P4: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python35\lib\site-packages\P4.py", line 410, in <module> import P4API ImportError: DLL load failed: The specified module could not be found. OS: Win 7 64 bit Python: 3.5.1 P4Python:


python - Using p4python with grep command

Does anyone knows how to use grep() command in P4Python? I am developing an script that runs with Perforce and makes it easy for me to search for specific texts inside multiple files. I already tried to create a tool in Perforce > Tools > Manage Custom Tools using P4 commands like p4 grep -n -B 1 -e text_searched %D but since I want to make the same search in multiple files, it ...


python - Not able to install p4python

I'm trying to install p4python on a freebsd which runs python 2.7.5. Im getting the following error. Using cached p4python-2016.1.1447008.tar.gz Complete output from command python setup.py egg_info: Attempting to load API from ftp.perforce.com Traceback (most recent call last): File "<string>", line 1, in <module> File "/tmp/pip-build-WK9yDa/p4python/setup.py", line 611,...


python - P4Python run method does not work on empty folder

I want to search a Perforce depot for files. I do this from a python script and use the p4python library command: list = p4.run("files", "//mypath/myfolder/*") This works fine as long as myfolder contains some files. I get a python list as a return value. But when there is no file in myfolder the program stops running and no error message...


python - p4python windows x64 build link errors

I've been trying to build p4python on 64 bit for windows, but I am getting the following link errors: Creating library build\temp.win-amd64-2.7\Release\P4API.lib and object build\temp.win-amd64-2.7\Release\P4API.exp librpc.lib(netssltransport.obj) : error LNK2019: unresolved external symbol SSLeay referenced in function "private: void __cdecl NetSslTransport::ValidateRuntimeVsCompiletimeSSLVersion(clas...


python - p4python check if any actions are being run

I have a threaded timer running to disconnect from p4 after a certain amount of time (because perforce will auto timeout in our application and fails to reconnect). I want to make sure that I do not disconnect if any long action is running (like downloading a large file). Are there any p4 commands that can check if there are currently commands being run. Thanks


python - P4Python cannot use progress class

I don’t know why this will raise AttributeError, but in document it seems right https://www.perforce.com/manuals/p4python/Content/P4Python/python.p4_progress.html from P4 import P4, P4Exception, Progress from tqdm import tqdm class P4ProgressHandler(Progress): TYPES = ["Unknow...






Still can't find your answer? Check out these communities...



PySlackers | Full Stack Python | NHS Python | Pythonist Cafe | Hacker Earth | Discord Python



top