P4PYTHON installation guide with known issues and solution

P4PYTHON installation guide with known issues and solution:-


Follow below steps to install p4python :-
1.       Download Packages
Download the Perforce C++ API from
ftp://ftp.perforce.com/perforce/r13.1/bin.linux26x86_64/p4api.tgz

Download the P4Python source code from
ftp://ftp.perforce.com/perforce/r13.1/bin.tools/p4python.tgz


2.       Extract the P4Python API archive into a new, empty directory.

[root@AJ-RHEL ~]# cd /p4server/plugins/
[root@AJ-RHEL plugins]# ll
total 1360
-rw-r----- 1 root  root  1311050 Mar 30 14:36 p4api.tgz
-rw-r----- 1 root  root    68950 Mar 30 14:36 p4python.tgz

[root@AJ-RHEL plugins]# tar -xf p4api.tgz;tar -xf p4python.tgz
drwxr-xr-x 5 20666 20666    4096 Apr 24  2014 p4api-2013.1.821990
drwxrwxrwx 3 root  root     4096 Mar 30 14:38 p4python-2013.1.642831

3.       To build P4Python, run the following command:

                   python setup.py build --apidir <Perforce C++ API absolute path>

                   Note: in order to reinstall cleanly P4Python, remove the directory named "build".

example :-
[root@AJ-RHEL p4python-2013.1.642831]# python setup.py build --apidir /p4server/plugins/p4api-2013.1.821990/

4.       Before running the build test , set p4d executable file into PATH variable by running :

export PATH=${PATH}:/p4/common/bin or
setenv PATH ${PATH}:/p4/common/bin

5.        To test your P4Python build, run the following command:

                   python p4test.py
example:-
[root@AJ-RHEL p4python-2013.1.642831]# pwd
/p4server/plugins/p4python-2013.1.642831
[root@AJ-RHEL p4python-2013.1.642831]# python p4test.py

6.        To install P4Python, run the following command:

                   python setup.py install --apidir <Perforce C++ API absolute path>

Example:-
[root@AJ-RHEL p4python-2013.1.642831]# pwd
/p4server/plugins/p4python-2013.1.642831
[root@AJ-RHEL p4python-2013.1.642831]# python setup.py install --apidir /p4server/plugins/p4api-2013.1.821990/


Known issue and resolution:-


1.       32-bit builds of P4Python require a 32-bit version of the C++ API and a 32-bit version of Python. 64-bit builds of P4Python require a 64-bit version of the C++ API and a 64-bit version of Python.

2.       Getting the below error while trying to run python setup.py build:
                Error: command 'gcc' failed with exit status 1

Resolution: python-devel rpm is missing (NOTE: python rpm and python-devel must have same version)

3.       Root user can import P4 module while running .py perforce script while non-root user cannot import P4 module.

Resolution:  need to give read permission to below site-packages which were generated after p4python installation:-

Before:-
[root@AJ-RHEL~]# ll /usr/lib64/python2.6/site-packages/ | grep -i p4
-rwxr-----   1 root root 2514156 Mar 30 14:38 P4API.so
-rw-r-----   1 root root   26990 May  1  2013 P4.py
-rw-r-----   1 root root   27928 Mar 30 14:38 P4.pyc
-rwxr-----   1 root root    1055 Mar 30 14:39 p4python-2013.1.642831-py2.6.egg-info

After:-
[root@AJ-RHEL ~]# ll /usr/lib64/python2.6/site-packages/ | grep -i p4
-rwxr-xr-x   1 root root 2514156 Mar 30 14:38 P4API.so
-rwxr-xr-x   1 root root   26990 May  1  2013 P4.py
-rwxr-xr-x   1 root root   27928 Mar 30 14:38 P4.pyc

-rwxr-xr-x   1 root root    1055 Mar 30 14:39 p4python-2013.1.642831-py2.6.egg-info

Comments

Popular posts from this blog

HP-UX virtual Machine Cheat Sheet

How to run fdisk in non-interactive mode