"""P4Python - Python interface to Perforce API Perforce is the fast SCM system at www.perforce.com. This package provides a simple interface from Python wrapping the Perforce C++ API to gain performance and ease of coding. Similar to interfaces available for Ruby and Perl. $Id: //depot/projects/p4python/main/setup.py#15 $ """ classifiers = """\ Development Status :: 5 - Production/Stable Intended Audience :: Developers License :: Freely Distributable Programming Language :: Python Topic :: Software Development :: Libraries :: Python Modules Topic :: Software Development :: Version Control Topic :: Software Development Topic :: Utilities Operating System :: Microsoft :: Windows Operating System :: Unix """ # Seems to work fine with ActiveState Python2.3 or 2.4 and Linux # Customisations needed to use to build: # 1. Set directory for p4api # 2. On other platforms, set appropriate compile flags # See notes in P4API documentation for building with API on different # platforms: # http://www.perforce.com/perforce/doc.042/manuals/p4api/02_clientprog.html from distutils.core import setup, Extension import ConfigParser import os, sys, re # Fix for older versions of Python if sys.version_info < (2, 3): _setup = setup def setup(**kwargs): if kwargs.has_key("classifiers"): del kwargs["classifiers"] _setup(**kwargs) # Extract version string from Version file - needs to be float. def get_p4_api_ver(p4_api_dir): pat = re.compile("RELEASE\s+=\s+(\d+)\s+(\d+)") # Handle 2007.2 api dir substructure and previous flat structure ver_file = os.path.join(p4_api_dir, "sample", "Version") if not os.path.exists(ver_file): ver_file = os.path.join(p4_api_dir, "Version") input = open(ver_file) for line in input: match = pat.match(line) if match: dir = match.group(1) result = "P4_API_VER=%s.%s" % (match.group(1), match.group(2)) input.close() return result doclines = __doc__.split("\n") NAME = "P4Python" VERSION = "1.0" PY_MODULES = ["p4"] P4_API_DIR = "p4api" P4_API_VER = "unknown" DESCRIPTION=doclines[0] AUTHOR="Robert Cowham" MAINTAINER="Robert Cowham" AUTHOR_EMAIL="robert@vaccaperna.co.uk" MAINTAINER_EMAIL="robert@vaccaperna.co.uk" LICENSE="http://public.perforce.com/guest/robert_cowham/perforce/API/python/main/LICENSE.txt" URL="http://public.perforce.com/guest/robert_cowham/perforce/API/python/index.html" KEYWORDS="Perforce perforce" P4_CONFIG_SECTION="p4python_config" P4_CONFIG_P4APIDIR="p4_api" def do_setup(): config = ConfigParser.ConfigParser() config.read('setup.cfg') p4_api_dir = None if config.has_section(P4_CONFIG_SECTION): if config.has_option(P4_CONFIG_SECTION, P4_CONFIG_P4APIDIR): p4_api_dir = config.get(P4_CONFIG_SECTION, P4_CONFIG_P4APIDIR) if not p4_api_dir: print "Error: %s section in setup.cfg needs option %s set to the directory containing the perforce API!" % ( P4_CONFIG_SECTION, P4_CONFIG_P4APIDIR) sys.exit(100) p4_api_ver = get_p4_api_ver(p4_api_dir) inc_path = [p4_api_dir, os.path.join(p4_api_dir, "include", "p4")] lib_path = [p4_api_dir, os.path.join(p4_api_dir, "lib")] if os.name == "nt": setup(name=NAME, version=VERSION, description=DESCRIPTION, author=AUTHOR, author_email=AUTHOR_EMAIL, maintainer=MAINTAINER, maintainer_email=MAINTAINER_EMAIL, license=LICENSE, url=URL, keywords=KEYWORDS, classifiers = filter(None, classifiers.split("\n")), long_description = "\n".join(doclines[2:]), py_modules=PY_MODULES, ext_modules=[Extension("P4Client", ["P4Clientmodule.cc"], include_dirs=inc_path, library_dirs=lib_path, libraries=["oldnames", "wsock32", "advapi32", # MSVC libs "libclient", "librpc", "libsupp"], # P4API libs extra_compile_args=["/DOS_NT", "/DMT", "/DCASE_INSENSITIVE", "/D%s" % p4_api_ver], # DEBUG options # extra_compile_args=["/DOS_NT", "/DMT", "/DCASE_INSENSITIVE", "/Od", '/Z7', '/D_DEBUG'], extra_link_args=["/NODEFAULTLIB:libcmt"], # extra_link_args=["/NODEFAULTLIB:libcmt", "/DEBUG"], )]) else: # Assume Linux setup(name=NAME, version=VERSION, description=DESCRIPTION, author=AUTHOR, author_email=AUTHOR_EMAIL, maintainer=MAINTAINER, maintainer_email=MAINTAINER_EMAIL, license=LICENSE, url=URL, keywords=KEYWORDS, classifiers = filter(None, classifiers.split("\n")), long_description = "\n".join(doclines[2:]), py_modules=PY_MODULES, ext_modules=[Extension("P4Client", ["P4Clientmodule.cc"], include_dirs=inc_path, library_dirs=lib_path, libraries=["client", "rpc", "supp"], # P4API libs extra_compile_args=["-DOS_LINUX", "-D%s" % p4_api_ver], )]) if __name__ == "__main__": do_setup()
# | Change | User | Description | Committed | |
---|---|---|---|---|---|
#19 | 6360 | Robert Cowham |
- Remove compiler warning for Python 2.5 vs 2.4 via #ifdef Version 1.2 |
||
#18 | 6145 | Robert Cowham | - Fixed setup.py error for Linux | ||
#17 | 6134 | Robert Cowham |
1.1 - Added raise error on dropped connection - thanks to Ryan Blazecka - Added Solaris option to setup.py (and tidied it a little) |
||
#16 | 6058 | Robert Cowham |
- Added Darwin option to setup.py - thanks to Lyndsey Ferguson. No other code changes. |
||
#15 | 6044 | Robert Cowham | Change filetypes | ||
#14 | 6043 | Robert Cowham | Changed license (with Mike's agreement) to make it more easily distributable and also maintainable by Perforce | ||
#13 | 5967 | Robert Cowham | - Upgrade to use Perforce API 2007.2 (new structure of api dirs and minor code change) | ||
#12 | 5966 | Robert Cowham |
- Bug fix in spec handling as suggested by Peter Fornwall - Also changed API handling suggested by Peter to allow standard argument parsing - Upgraded version to 1.0 |
||
#11 | 5746 | Robert Cowham | Got api testing working properly! | ||
#10 | 5745 | Robert Cowham |
- Added option to read api ver P4.p4_api_ver - Added tests for different P4 API builds Use macro stringification to get P4 API VER. |
||
#9 | 5743 | Robert Cowham | Test wrapper for testing with different API versions | ||
#8 | 5728 | Robert Cowham | Update .zip files with latest changes | ||
#7 | 5061 | Robert Cowham | Updated distutils info for PyPI registration. | ||
#6 | 5057 | Robert Cowham |
- Added P4Error class and catch all errors - shouldn't see P4Client.error any more! - Raise the error when appropriate. - Added translate() function to allow working with Internationalised servers. - Fix problem with diff2 and diff |
||
#5 | 4812 | Robert Cowham |
Made it ready for PyPI (Python Package Index) release and did that. Fixed perf.py script to be compatible with latest changes. |
||
#4 | 4771 | Robert Cowham |
Revised build procedures. Release updated binaries from previous checkin. |
||
#3 | 4766 | Robert Cowham |
Rather better documentation (and license and changelog). Reorganised dirs. Added .zip file and windows binary installer. |
||
#2 | 4758 | Robert Cowham |
Fix line endings. Make less Windows specific. |
||
#1 | 4755 | Robert Cowham |
Rename //guest/robert_cowham/perforce/API/python/P4Client/... To //guest/robert_cowham/perforce/API/python/main/... |
||
//guest/robert_cowham/perforce/API/python/P4Client/setup.py | |||||
#2 | 4618 | Robert Cowham |
Note that the contents of p4.py is now in p4cmd.py as I want to re-use the name p4.py for the more general module case. Started converting package to be more like p4ruby and p4perl in the way it works. |
||
#1 | 4592 | Robert Cowham |
Untabbed. Added setup.py - works for ActiveState Python 2.3! |