PyCXX V7.1.4 to build against Python 2 or Python 3 which is included in the pysvn source kit.
Some distributions will split python and subversion into more the one package.
You will need to find all the packages that give you the options listed above.
Building on win32
PYSVN sources have been updated to build on Windows 7 64bit version.
Expect issues on older windows and 32but windows.
These instructions assume you have Microsoft Visual C++ to compile the code
and INNO 5 to create the installation kit.
Build subversion
Fetch and expand the pysvn source code into extdir
Expand pycxx-7.1.4.tar.gz into extdir\Import if not using a source kit
Edit Builder\builder_custom_init.cmd to match the locations of the sources.
cd Builder
builder_custom_init.cmd
cd ..\Source
python setup.py configure ... (add any configure options required to make it find the required libraries).
nmake
cd ..\Test
nmake
cd ..\Kit\Windows
nmake
To install the built kit
Uninstall any previous kit (control panel's Add/Remove programs)
nmake -f win32.mak install
Building on unix and Mac OS X systems.
Install subversion.
When installing from packages you will need to install the devel packages as well. For example on Fedora/Redhat subversion-devel, apr-devel, apr-util-devel and their dependancies.
Get the pysvn source code
For Python 2 or Python 3 builds: tar xzf pycxx-7.1.4.tar.gz into extdir/Import if not using a source kit
cd Source
Create the Makefile using python setup.py configure
make
cd Tests
Test pysvn by running make
Install pysvn by copying the following from Extension/Source
to python site-specific directory.
pysvn-1.9.22/Patches/ 000755 000765 000024 00000000000 14527655012 014644 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Source/ 000755 000765 000024 00000000000 14527655013 014516 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Tests/ 000755 000765 000024 00000000000 14527655016 014363 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Kit/ 000755 000765 000024 00000000000 14527655012 014004 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/MANIFEST.in 000644 000765 000024 00000001057 12605756242 015020 0 ustar 00barry staff 000000 000000 recursive-include Builder *
recursive-include Docs *
recursive-include Examples *
recursive-include Import *
recursive-include Kit *
recursive-include Patches *
recursive-include Source *
recursive-include Tests *
include INSTALL.html
include LICENSE.txt
exclude Source/pysvn/__init__.py
exclude Source/pysvn/*.so
exclude Source/*.o
exclude Source/Makefile
exclude Source/pysvn_docs.cpp
exclude Source/pysvn_docs.hpp
exclude Source/pysvn_version.hpp
exclude Source/generate_svn_error_codes.hpp
exclude Source/generate_svn_error_codes/generate_svn_error_codes
pysvn-1.9.22/Docs/ 000755 000765 000024 00000000000 14527655012 014145 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/setup.py 000644 000765 000024 00000010136 14324737627 015000 0 ustar 00barry staff 000000 000000 #
# ====================================================================
# (c) 2005-2009 Barry A Scott. All rights reserved.
#
# This software is licensed as described in the file LICENSE.txt,
# which you should have received as part of this distribution.
#
# ====================================================================
#
#
# setup.py
#
# Handles creation of Python eggs, wheels, and source distributions.
#
# To build a source distribution, run:
#
# $ python setup.py sdist
#
# To build an egg, run:
#
# $ python setup.py bdist_egg
#
# To build a wheel, make sure you have the wheel package
# (`pip install wheel`). This is available on newer systems by defaul.
# Then run:
#
# $ python setup.py bdist_wheel
#
# These can all be built and uploaded to PyPI in one command:
#
# $ python setup.py sdist bdist_egg bdist_wheel upload
#
# Subsequent native eggs and wheels can be uploaded to PyPI with:
#
# $ python setup.py bdist_egg bdist_wheel upload
#
import setuptools
import sysconfig
import platform
import shutil
import sys
import os
import os.path
from setuptools.command.build_ext import build_ext
pysvn_version_info = {}
f = open( 'Builder/version.info', 'r' )
for line in f:
key, value = line.strip().split('=')
pysvn_version_info[ key ] = value
name = "pysvn"
_pysvn_soname = '_pysvn_%d_%d' % sys.version_info[:2]
class BuildExtensions(build_ext):
"""Builds the packages using the PySVN Makefile build system.
This overrides the Python builder's build_ext command, invoking the
Makefile build system to compile the deliverable pysvn/ directory. It
then installs the deliverables to the right place so that they can be
included in the package.
By going through the build_ext route, the Python packaging infrastructure
will generate compiled eggs/wheels that only install on systems compatible
with the compiled pysvn.so. pip/easy_install will locate and install a
compatible build, falling back on automatically compiling the source
distribution.
"""
def build_extension( self, ext ):
if ext.name == _pysvn_soname:
self._build_pysvn( ext )
else:
super( BuildExtensions, self ).build_extension( ext )
def _build_pysvn( self, ext ):
dest_dir = os.path.join( os.path.abspath( self.build_lib ), 'pysvn' )
# Generate metadata first
self.run_command( "egg_info" )
if platform.system() == 'Darwin':
# For Mac, figure out the major.minor version of the OS, and
# pass that information to the build system.
os.putenv( 'MACOSX_DEPLOYMENT_TARGET',
'.'.join( platform.mac_ver()[ 0 ].split( '.' )[ :2 ] ) )
# Invoke the build system. This will generate the __init__.py and
# .so that we'll package.
os.chdir( 'Source' )
os.system( sys.executable + ' setup.py configure' )
os.system( 'make clean' )
os.system( 'make' )
# Copy the built files to the destination pysvn/ directory.
self.mkpath( dest_dir )
shutil.copy( os.path.join( 'pysvn', '__init__.py' ), dest_dir )
shutil.copy( os.path.join( 'pysvn', '%s.so' % _pysvn_soname ),
dest_dir )
# We're done. Restore the working directory.
os.chdir( '..' )
setuptools.setup(
name = name,
version='%(MAJOR)s.%(MINOR)s.%(PATCH)s' % pysvn_version_info,
author="Barry Scott",
author_email="barry@barrys-emacs.org",
description="Subversion support for Python",
long_description="",
url="https://pysvn.sourceforge.io",
license="Apache Software License",
keywords="subversion",
include_package_data=True,
zip_safe=False,
cmdclass={
'build_ext': BuildExtensions,
},
ext_modules = [
setuptools.Extension(
_pysvn_soname, []) # This used to tell setuptools that
# there is native extension, but
# they're not build using setuptools.
],
classifiers=[
"Topic :: Software Development :: Version Control",
],
)
pysvn-1.9.22/Examples/ 000755 000765 000024 00000000000 14527655011 015032 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/setup.cfg 000644 000765 000024 00000000014 11411352312 015053 0 ustar 00barry staff 000000 000000 [egg_info]
pysvn-1.9.22/LICENSE.txt 000644 000765 000024 00000004315 11724430522 015074 0 ustar 00barry staff 000000 000000 =================================================================
Copyright (C) 2003-2012 Barry A. Scott. All rights reserved.
=================================================================
The Apache Software License, Version 1.1
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in
the documentation and/or other materials provided with the
distribution.
3. The end-user documentation included with the redistribution,
if any, must include the following acknowledgment:
"This product includes software developed by
Barry A. Scott http://www.barrys-emacs.org."
Alternately, this acknowledgment may appear in the software itself,
if and wherever such third-party acknowledgments normally appear.
4. The names "PySVN" must not be used to endorse or promote
products derived from this software without prior written
permission. For written permission, please contact
barry@barrys-emacs.org.
5. Products derived from this software may not be called "PySVN",
nor may "PySVN" appear in their name, without prior written
permission of Barry Scott.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESSED OR IMPLIED
WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE APACHE SOFTWARE FOUNDATION OR
ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF
USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
=================================================================
pysvn-1.9.22/Import/ 000755 000765 000024 00000000000 14527655017 014534 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Builder/ 000755 000765 000024 00000000000 14527655016 014647 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Builder/brand_version.py 000755 000765 000024 00000006720 14072544500 020052 0 ustar 00barry staff 000000 000000 import sys
import os
import re
SVN_REVISION_FILE = '../Builder/svn-revision.txt'
class BrandingError(Exception):
pass
class BrandVersion:
def __init__( self ):
# create dictionary of branding strings
self.branding_info = {}
self.version_details = None
self.input_filename = None
self.output_filename = None
def main( self, argv ):
try:
self.version_details = argv[1]
self.input_filename = argv[2]
self.output_filename = self.input_filename[:-len('.template')]
self.loadVersionDetails()
self.setBuildFromRevision()
self.brandFile()
return 0
except BrandingError as e:
print( 'Error: %s' % (e,) )
return 1
def brandFile( self ):
# read all the input text
with open( self.input_filename, 'r' ) as f:
text = f.read()
# and write of a branded version
with open( self.output_filename, 'w' ) as f:
f.write( text % self.branding_info )
def loadVersionDetails( self ):
with open( self.version_details ) as f:
for line in f:
line = line.strip()
if len(line) == 0:
continue
if line[0:1] == ['#']:
continue
key, value = [s.strip() for s in line.split('=',1)]
self.branding_info[ key ] = value
def setBuildFromRevision( self ):
if os.path.exists( SVN_REVISION_FILE ):
with open( SVN_REVISION_FILE ) as f:
build_revision = f.read().strip()
if build_revision[0] not in '0123456789':
raise BrandingError( 'Error: bad revision %r from %s' % (build_revision, SVN_REVISION_FILE) )
else:
build_revision = self.getBuildFromRevisionUsingSvnversion()
# build_revision is either a range nnn:mmm or mmm
# we only want the mmm
build_revision = build_revision.split(':')[-1]
print( 'Info: revision %s' % (build_revision,) )
if build_revision[0] not in '0123456789':
self.branding_info['BUILD'] = '0'
return
revision, modifiers = re.compile( r'(\d+)(.*)' ).search( build_revision ).groups()
if modifiers:
self.branding_info['BUILD'] = '0'
else:
self.branding_info['BUILD'] = revision
def getBuildFromRevisionUsingSvnversion( self ):
svnversion_image = os.environ.get( 'WC_SVNVERSION', '/usr/bin/svnversion' )
if not os.path.exists( svnversion_image ):
raise BrandingError( 'Error: svnversion image not found at %r' % (svnversion_image,) )
# os.popen fails to run a quoted image that does not have a space in it path
if ' ' in svnversion_image:
cmd = ('"%s" -c "%s" 2>&1' %
(svnversion_image
,os.environ.get( 'PYSVN_EXPORTED_FROM', '..' )))
else:
cmd = ('%s -c "%s" 2>&1' %
(svnversion_image
,os.environ.get( 'PYSVN_EXPORTED_FROM', '..' )))
print( 'Info: Running %s' % cmd )
build_revision = os.popen( cmd, 'r' ).read().strip()
if build_revision[0] not in '0123456789':
raise BrandingError( 'Error: svnversion %r bad output %r' % (svnversion_image, build_revision) )
return build_revision
if __name__ == '__main__':
sys.exit( BrandVersion().main( sys.argv ) )
pysvn-1.9.22/Builder/version.info 000644 000765 000024 00000000041 14527422525 017201 0 ustar 00barry staff 000000 000000 MAJOR=1
MINOR=9
PATCH=22
BUILD=0
pysvn-1.9.22/Builder/win32-msvc90.mak 000644 000765 000024 00000001242 12273441101 017401 0 ustar 00barry staff 000000 000000 BUILD_TYPE=Release
SVN_VER_MAJ_MIN=1.7
VCBUILD_OPT=/useenv /nologo /nocolor "/info:Info: " "/error:Error: " "/warning:Warn: "
build: all test kit
all:
cd ..\Source & $(PYTHON) setup.py configure --verbose --platform=win32 --svn-root-dir=$(TARGET)\svn-win32-%SVN_VER% --pycxx-dir=$(PYCXX)
cd ..\Source & $(MAKE)
test:
cd ..\Tests & $(MAKE)
clean:
cd ..\Source & if exist makefile $(MAKE) clean
cd ..\Source & if exist sept del sept
cd ..\Tests & if exist makefile $(MAKE) clean
cd ..\kit\Win32-$(SVN_VER_MAJ_MIN) & $(MAKE) clean
kit:
cd ..\kit\Win32-$(SVN_VER_MAJ_MIN) & $(MAKE) all_msvc90
install:
..\kit\Win32\tmp\output\setup.exe
pysvn-1.9.22/Builder/linux.mak 000644 000765 000024 00000001070 11655237433 016474 0 ustar 00barry staff 000000 000000 build: all test kit
all: ../Source/Makefile
cd ../Source && $(MAKE)
clean: ../Source/Makefile
cd ../Source && $(MAKE) clean && rm Makefile
cd ../Tests && $(MAKE) clean && rm Makefile
rm -rf ../Kit/Linux/tmp
../Source/Makefile: ../Source/setup.py
cd ../Source && $(PYTHON) setup.py configure --platform=linux $(CONFIG_ARGS)
kit:
cd ../Kit/Linux && $(PYTHON) make_rpm.py
install:
echo sudo may prompt for your password to allow installation of the pysvn rpm
sudo rpm -i ../Kit/Linux/tmp/RPMS/i386/py*_pysvn-*-1.i386.rpm
test:
cd ../Tests && $(MAKE) all
pysvn-1.9.22/Builder/builder_custom_init.cmd 000644 000765 000024 00000000013 12701252063 021354 0 ustar 00barry staff 000000 000000 rem empty
pysvn-1.9.22/Builder/builder_custom_init.sh 000755 000765 000024 00000001242 14477277705 021261 0 ustar 00barry staff 000000 000000 #!/bin/echo Usage: . $0
# default to highest version we can find if no value in $1 and $2
if [ ! -z "$1" ]
then
PREF_VER=$1.$2
else
PREF_VER=3.10
fi
export PYCXX_VER=7.1.9
for PY_VER in ${PREF_VER} 3.10 3.9
do
# used in pick python to use in Builder driver makefile
export PYTHON=$( which python${PY_VER} )
if [ -e "${PYTHON}" ]
then
break
fi
done
unset PREF_VER
if [ -e "${PYTHON}" ]
then
# prove the python version selected is as expected
${PYTHON} -c "import sys;print( 'Info: Python Version %r' % sys.version )"
else
echo "Error: Cannot find python${PREF_VER} on the PATH"
fi
export WC_SVNVERSION=$(which svnversion)
pysvn-1.9.22/Builder/win32-msvc71.mak 000644 000765 000024 00000003717 11264374000 017413 0 ustar 00barry staff 000000 000000 BUILD_TYPE=Release
SVN_VER_MAJ_MIN=1.5
build: all test kit
all: all-$(SVN_VER_MAJ_MIN)
all-1.4:
cd ..\Source & devenv pysvn-for-svn-1-4-msvc71.sln /useenv /build "$(BUILD_TYPE)" /project "pysvn"
all-1.5:
cd ..\Source & devenv pysvn-for-svn-1-5-msvc71.sln /useenv /build "$(BUILD_TYPE)" /project "pysvn"
all-1.6:
cd ..\Source & devenv pysvn-for-svn-1-6-msvc71.sln /useenv /build "$(BUILD_TYPE)" /project "pysvn"
clean: clean-$(SVN_VER_MAJ_MIN)
clean-1.4:
cd ..\Source & devenv pysvn-for-svn-1-4-msvc71.sln /useenv /clean "$(BUILD_TYPE)" /project "pysvn"
cd ..\Source & del sept
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.4 clean
cd ..\kit\Win32-1.4 & $(MAKE) clean
clean-1.5:
cd ..\Source & devenv pysvn-for-svn-1-5-msvc71.sln /useenv /clean "$(BUILD_TYPE)" /project "pysvn"
cd ..\Source & del sept
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.5 clean
cd ..\kit\Win32-1.5 & $(MAKE) clean
clean-1.6:
cd ..\Source & devenv pysvn-for-svn-1-6-msvc71.sln /useenv /clean "$(BUILD_TYPE)" /project "pysvn"
cd ..\Source & del sept
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.6 clean
cd ..\kit\Win32-1.6 & $(MAKE) clean
kit: kit-$(SVN_VER_MAJ_MIN)
kit-1.4:
cd ..\kit\Win32-1.4 & $(MAKE) all_msvc71
kit-1.5:
cd ..\kit\Win32-1.5 & $(MAKE) all_msvc71
kit-1.6:
cd ..\kit\Win32-1.6 & $(MAKE) all_msvc71
install: install-$(SVN_VER_MAJ_MIN)
install-1.4:
..\kit\Win32\tmp\output\setup.exe
install-1.5:
..\kit\Win32\tmp\output\setup.exe
install-1.6:
..\kit\Win32\tmp\output\setup.exe
test: test-$(SVN_VER_MAJ_MIN)
test-1.4:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.4 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
test-1.5:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.5 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
test-1.6:
cd ..\Tests & $(MAKE) -f win32.mak SVN_VER_MAJ_MIN=1.6 KNOWN_GOOD_VERSION=py$(PY_MAJ)-svn$(SVN_VER_MAJ_MIN)
pysvn-1.9.22/Builder/svn-revision.txt 000644 000765 000024 00000000005 14527655017 020046 0 ustar 00barry staff 000000 000000 2125
pysvn-1.9.22/Builder/freebsd.mak 000644 000765 000024 00000000551 10411462216 016736 0 ustar 00barry staff 000000 000000 build: all test kit
all: ../Source/Makefile
cd ../Source && $(MAKE)
clean: ../Source/Makefile
cd ../Source && $(MAKE) clean && rm Makefile
cd ../Tests && $(MAKE) clean && rm Makefile
../Source/Makefile: ../Source/setup.py
cd ../Source && $(PYTHON) setup.py configure
kit:
cd ../Kit/FreeBSD && $(PYTHON) make_pkg.py
test:
cd ../Tests && $(MAKE) all
pysvn-1.9.22/Builder/make-devel-rpm-build.sh 000755 000765 000024 00000001145 12764754136 021116 0 ustar 00barry staff 000000 000000 #!/bin/bash -x
#
# make-devel-rpm-build.sh
#
# Create a source kit and copy it and the rpm spec file to ~/rpmbuild locations
#
. ./version.info
V=${MAJOR}.${MINOR}.${PATCH}
rm -rf /tmp/pysvn-${V}
svn export --quiet .. /tmp/pysvn-${V}
BUILD=$( svnversion .. )
cat </tmp/pysvn-${V}/Builder/version.info
MAJOR=${MAJOR}
MINOR=${MINOR}
PATCH=${PATCH}
BUILD=${BUILD}
EOF
echo Info: Creating source kit...
mkdir -p /tmp/rpmbuild/SOURCES
mkdir -p /tmp/rpmbuild/SPECS
tar czf /tmp/rpmbuild/SOURCES/pysvn-${V}.tar.gz -C /tmp pysvn-${V}
echo Info: Running rpmbuild
cd /tmp/rpmbuild/SPECS
rpmbuild -ba pysvn.spec
pysvn-1.9.22/Builder/macosx.mak 000644 000765 000024 00000000556 11062516532 016627 0 ustar 00barry staff 000000 000000 build: all test kit
all: ../Source/Makefile
cd ../Source && $(MAKE)
clean: ../Source/Makefile
cd ../Source && $(MAKE) clean && rm Makefile
cd ../Tests && $(MAKE) clean
../Source/Makefile: ../Source/setup.py
cd ../Source && $(PYTHON) -u setup.py configure $(CONFIG_ARGS)
kit:
cd ../Kit/MacOSX && $(PYTHON) -u make_pkg.py
test:
cd ../Tests && $(MAKE) all
pysvn-1.9.22/Import/pycxx-7.1.9/ 000755 000765 000024 00000000000 14477104307 016354 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/Demo/ 000755 000765 000024 00000000000 14477104307 017240 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/obj/ 000755 000765 000024 00000000000 14477104307 017126 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/build-all.py 000755 000765 000024 00000007415 14443557171 020611 0 ustar 00barry staff 000000 000000 #!/usr/bin/python3
import sys
import os
import subprocess
first_limited_api_minor = 4
# (major, minor, bits, vc_ver)
default_versions_to_test = [
(2, 7, 32, '9.0'), (2, 7, 64, '9.0'),
(3, 3, 32, '10.0'), # no compiler for windows 64 bit
(3, 4, 32, '10.0'), # no compiler for windows 64 bit
(3, 5, 32, '14.0'), (3, 5, 64, '14.0'),
(3, 6, 32, '2017'), (3, 6, 64, '2017'),
(3, 7, 32, '2017'), (3, 7, 64, '2017'),
(3, 8, 32, '2017'), (3, 8, 64, '2017'),
(3, 9, 32, '2019'), (3, 9, 64, '2019'),
(3, 10, 32, '2019'), (3, 10, 64, '2019'),
(3, 11, 32, '14.0'), (3, 11, 64, '14.0'),
(3, 12, 32, '14.0'), (3, 12, 64, '14.0'),
]
def main( argv ):
dry_run = False
all_versions_to_test = []
setup_makefile_options = []
for arg in argv[1:]:
if arg == '--dry-run':
dry_run = True
elif arg.startswith( '--' ):
# assume its for setup_makefile
setup_makefile_options.append( arg )
else:
# convert all the args into a list of versions to test
# assume py.exe format maj.min or maj.min-bits
try:
if '-' in arg:
major_minor, bits = arg.split('-')
else:
major_minor = arg
bits = '64'
major, minor = major_minor.split('.')
major = int(major)
minor = int(minor)
bits = int(bits)
except ValueError:
print( 'Error: Expecting .[-] 3.9-64 given %r' % (arg,) )
return 1
# find the vc_ver from the default_versions_to_test
vc_ver = None
for info in default_versions_to_test:
if info[:3] == (major, minor, bits):
vc_ver = info[3]
if vc_ver is None:
print( 'Error: Update default_versions_to_test for %d.%d-%d - vc_ver cannot be determined' %
(major, minor, bits) )
return 1
all_versions_to_test.append( (major, minor, bits, vc_ver) )
if len(all_versions_to_test) == 0:
all_versions_to_test = default_versions_to_test
#
# Run all the requested builds
#
is_win = sys.platform.startswith( 'win' )
tag = []
if os.environ.get('TAG'):
tag = [os.environ.get('TAG')]
for major, minor, bits, vc_ver in all_versions_to_test:
if is_win:
fmt = '.\\%s.cmd'
else:
# Only windows needs to build both 32 and 64 bit
# for the mac and linux only build once
if bits == 32:
continue
fmt = './%s.sh'
if is_win:
cmd = [fmt % ('build-unlimited-api',), '%d.%d' % (major, minor), 'win%d' % (bits,), vc_ver] + setup_makefile_options
else:
cmd = [fmt % ('build-unlimited-api',), 'python%d.%d' % (major, minor)] + setup_makefile_options
print( 'Info: %s' % (' '.join(cmd),), flush=True )
if not dry_run:
subprocess.run( cmd )
if major == 2:
continue
for api_minor in range( first_limited_api_minor, minor+1 ):
if is_win:
cmd = [fmt % ('build-limited-api',), '%d.%d' % (major, minor), 'win%d' % (bits,), vc_ver]
else:
cmd = [fmt % ('build-limited-api',), 'python%d.%d' % (major, minor)]
# add the API version to use
cmd.append( '%d.%d' % (major, api_minor) )
cmd.extend( setup_makefile_options )
print( 'Info: %s' % (' '.join(cmd),), flush=True )
if not dry_run:
subprocess.run( cmd )
return 0
if __name__ == '__main__':
sys.exit( main( sys.argv ) )
pysvn-1.9.22/Import/pycxx-7.1.9/tag_pycxx.py 000644 000765 000024 00000005530 14202154313 020723 0 ustar 00barry staff 000000 000000 import pysvn
import sys
import os
def check_version( version ):
vars = {}
with open('CXX/Version.hxx') as f:
for line in f:
words = line.split()
if( len(words) >= 3
and words[0] == '#define'
and words[1].startswith('PYCXX_VERSION_') ):
vars[ words[1] ] = words[2]
defined_version = '%(PYCXX_VERSION_MAJOR)s.%(PYCXX_VERSION_MINOR)s.%(PYCXX_VERSION_PATCH)s' % vars
print( 'Info: %s defined in Version.hxx' % (defined_version,) )
if defined_version == version:
return True
print( 'Error: %s does not match defined version' % (version,) )
return False
def make_tag( from_url, tag_base_url, version ):
client = pysvn.Client()
client.callback_get_log_message = lambda : (True, 'Tag version '+version)
client.callback_get_login = callback_getLogin
try:
from_files = client.ls( from_url, recurse=False )
print( 'Info: Found', from_url )
except pysvn.ClientError as e:
print( 'Error: From does not exist',from_url )
return
try:
tag_files = client.ls( tag_base_url, recurse=False )
print( 'Info: Found', tag_base_url )
except pysvn.ClientError as e:
print( 'Error: Tag base does not exist', tag_base_url )
return
cur_versions = [os.path.basename(f['name']) for f in tag_files]
if version in cur_versions:
print( 'Error: Already tagged', version )
return
try:
to_url = tag_base_url + '/' + version
print( 'Info: Copy', repr(from_url), repr(to_url) )
client.copy( from_url, to_url )
print( 'Info: Copy complete' )
except pysvn.ClientError as e:
print( 'Error: ', str(e) )
return
def callback_getLogin( realm, username, may_save ):
print( 'May save:', may_save )
print( 'Realm:', realm )
if username:
print( 'Username:', username )
else:
print( 'Username: ', end='', flush=True )
username = sys.stdin.readline().strip()
if len(username) == 0:
return 0, '', '', False
print( 'Password: ', end='', flush=True )
password = sys.stdin.readline().strip()
save_password = 'x'
while save_password.lower() not in ['y','ye','yes','n', 'no','']:
print( 'Save password? [y/n] ', end='', flush=True )
save_password = sys.stdin.readline().strip()
return 1, username, password, save_password in ['y','ye','yes']
def main( argv ):
if len(argv) != 2:
print( 'Usage: %s ' % (sys.argv[0],) )
return
version = sys.argv[1]
if not check_version( version ):
return 1
from_url = 'https://svn.code.sf.net/p/cxx/code/trunk/CXX'
tag_base_url = 'https://svn.code.sf.net/p/cxx/code/tags'
make_tag( from_url, tag_base_url, version )
if __name__ == '__main__':
sys.exit( main( sys.argv ) )
pysvn-1.9.22/Import/pycxx-7.1.9/make_src_kit.py 000644 000765 000024 00000002230 13403242271 021345 0 ustar 00barry staff 000000 000000 import sys
import os
import shutil
def main( argv ):
f = open( 'CXX/Version.hxx' )
major = None
minor = None
patch = None
for line in f:
words = line.split()
if words[0:2] == ['#define', 'PYCXX_VERSION_MAJOR']:
major = words[2]
if words[0:2] == ['#define', 'PYCXX_VERSION_MINOR']:
minor = words[2]
if words[0:2] == ['#define', 'PYCXX_VERSION_PATCH']:
patch = words[2]
print( 'version: %s, %s, %s' % (major, minor, patch) )
tmp_dir = os.environ.get('TMPDIR','/tmp')
kit_name = 'pycxx-%s.%s.%s' % (major, minor, patch)
kit_dir = os.path.join( tmp_dir, kit_name )
if os.path.exists( kit_dir ):
print( 'Info: Removing tree at %s' % kit_dir )
shutil.rmtree( kit_dir )
os.mkdir( kit_dir )
print( 'Info: svn export %s' % kit_dir )
os.system( 'svn export --force . %s' % kit_dir )
print( 'Info: Creating %s.tar.gz' % kit_dir )
os.chdir( tmp_dir )
cmd = 'tar czf %s.tar.gz --exclude=%s/SourceForge %s' % (kit_dir, kit_name, kit_name)
os.system( cmd )
return 0
if __name__ == '__main__':
sys.exit( main( sys.argv ) )
pysvn-1.9.22/Import/pycxx-7.1.9/build-unlimited-api.sh 000755 000765 000024 00000001107 14300500451 022531 0 ustar 00barry staff 000000 000000 #!/bin/bash
set -x
set -e
set -o pipefail
PYTHON=${1? python exe}
shift 1
case "$( uname )" in
Darwin)
OS=macosx
;;
Linux):
OS=linux
;;
*)
echo Unknown OS assuming Linux
OS=linux
;;
esac
PYTHON_BASE=$(basename ${PYTHON})
TAG="${1}${2}${3}${4}"
${PYTHON} setup_makefile.py ${OS} tmp-${PYTHON_BASE}-unlimited-api${TAG}.mak "${@}"
make -f tmp-${PYTHON_BASE}-unlimited-api${TAG}.mak clean 2>&1 | tee tmp-${PYTHON_BASE}-unlimited-api${TAG}.log
make -f tmp-${PYTHON_BASE}-unlimited-api${TAG}.mak test 2>&1 | tee -a tmp-${PYTHON_BASE}-unlimited-api${TAG}.log
pysvn-1.9.22/Import/pycxx-7.1.9/CXX/ 000755 000765 000024 00000000000 14477104307 017016 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/build-unlimited-api.cmd 000644 000765 000024 00000004166 14305137454 022705 0 ustar 00barry staff 000000 000000 setlocal
rem Mm e.g. 27 36 etc
set PYTHON_VER=%1
rem win32 or win64
set PYTHON_ARCH=%2
rem 9.0, 14.0
set VC_VER=%3
echo ----------------------------------------------------
echo Testing unlimited API for python %1 %2 using VC %3
echo ----------------------------------------------------
if %PYTHON_ARCH% == win32 (
set PYTHON_VER_ARCH=%PYTHON_VER%-32
if %VC_VER% == 9.0 (
call "%LOCALAPPDATA%\Programs\Common\Microsoft\Visual C++ for Python\%VC_VER%\vcvarsall.bat" x86
) else (
if exist "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\vcvarsall.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\vcvarsall.bat"
)
if exist "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat" (
call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars32.bat"
)
)
)
if %PYTHON_ARCH% == win64 (
set PYTHON_VER_ARCH=%PYTHON_VER%-64
if %VC_VER% == 9.0 (
call "%LOCALAPPDATA%\Programs\Common\Microsoft\Visual C++ for Python\%VC_VER%\vcvarsall.bat" x64
) else (
if exist "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\bin\amd64\vcvars64.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\bin\amd64\vcvars64.bat"
)
if exist "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat" (
call "c:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat"
)
)
)
py -%PYTHON_VER_ARCH% setup_makefile.py %PYTHON_ARCH% tmp-%PYTHON_ARCH%-python%PYTHON_VER%-unlimited-build.mak
if errorlevel 1 exit /b 1
nmake -f tmp-%PYTHON_ARCH%-python%PYTHON_VER%-unlimited-build.mak clean all 2>&1 | py -3 build_tee.py tmp-%PYTHON_ARCH%-python%PYTHON_VER%-unlimited-build.log
if not exist obj\pycxx_iter.pyd exit /b 1
nmake -f tmp-%PYTHON_ARCH%-python%PYTHON_VER%-unlimited-build.mak test 2>&1 | py -3 build_tee.py -a tmp-%PYTHON_ARCH%-python%PYTHON_VER%-unlimited-test.log
endlocal
pysvn-1.9.22/Import/pycxx-7.1.9/build-all.cmd 000644 000765 000024 00000000027 14305137454 020704 0 ustar 00barry staff 000000 000000 py -3 build-all.py %*
pysvn-1.9.22/Import/pycxx-7.1.9/README.html 000644 000765 000024 00000023135 14477045070 020204 0 ustar 00barry staff 000000 000000
PyCXX README
Replace build-all.sh and build-all.cmd with build-all.py that can handle the build matrix.
Add limited API builds for all possible combinations.
Note: Python 3.9 has a bug that prevents use of the limited API until this bug is fix and shipped:
BPO 43155 for details.
The workaround is to set Py_LIMITED_API to use python 3.8.
Version: 7.1.4 (31-May-2020)
Add support for more number methods, like matrix and the inplace versions.
Use IsInstance checking so that derived classes of builtin types can be used.
Remove support for supportPrint() etc as the tp_print field is being removed from python either in 3.8 or 3.9.
Version: 7.1.2 (4-Mar-2019)
Fix problem with compiling for Python 2 and
the _Py_PackageContext symbol.
Merge Fedora's patch for setup.py
Version: 7.1.1 (18-Feb-2019)
Add exception errorType() and errorValue() function to access
the type and value of an exception.
Version: 7.1.0 (24-August-2018)
Add support for Py_LIMITED_API aka PEP-384
Version: 7.0.3 (23-April-2017)
Update Py::Long to support long long consitently between Python2 and Python3.
Version: 7.0.2 (16-April-2017)
Add Py::Char ord() method to return the long value of a character.
Fix String::size() that could return twice the actual length.
This affected as_ucs4string() which would return a string with
its second half as uninitialised memory.
Fix setup.py for the Demo code to build all the required C++
code.
Version: 7.0.1 (29-Aug-2016)
Add extra methods to Py::String that as needed on Windows to support full unicode range of code points.
On Windows Python defines Py_UNICODE as unsigned short, which is too small to hold all Unicode values.
PyCXX has added to the Py::String API to support creationg from Py_UCS4 strings and converting Py::String() into Py::ucs4string objects.
Fix validate for Bytes to use the correct check function.
Version 7.0.0 (15-Aug-2016)
Warning: This version fixes a number of problems that require source incompatible changes.
However by defining PYCXX_6_2_COMPATIBILITY the V6.2.x API is restored.
This is not recommended for new code.
The first version of python3 that is supported is 3.3.
A special thanks goes to Benjamin Webb, working at the US Army
Engineer Research and Development Center, who has contributed to
the design and testing of this release. 7.0.0 is better for his work.
New source file needs to built: Src/cxx_exceptions.cxx.
This file implements the new exception handling features.
Fix the type used for lengths and sequence indexes to use Py_ssize_t.
This will require sources changes for users of PyCXX.
Implement smart handling of Exceptions between C++ and Python.
You can now catch exceptions in C++ by type that are raised in C++ or Python.
All builtin exceptions are support and are user defined exceptions.
The base exception type is now BaseException not Exception.
To upgrade source code replace all use of Exception with BaseException.
The documentation has been updated to describe the new exception features.
The supportSequence, supportMapping, supportNumber etc functions
now take a bit mask that defines which specific callbacks are handled.
Version 6.2.8 (10-May-2016)
Fix crash when a member function is called via callMemberFunction() and that function raises an expection.
Found in comment on StackOverFlow. Fix memory size allocated for new objects. It used the wrong size calculation, but was big enough to avoid problems.
Version 6.2.7 (28-Apr-2016)
Fix missing ptr__Unicode_Type.
Fixes from learn0more@gmail.com make python2 also remember the m_module and add accessor functions.
Fix for indirection issues from Vivian De Smedt.
Update to work with latest Microsoft Visual C++ for python 2.7. All test run in Win32 and Win64.
PyCXX.html documention has been updated, especially with 2TO3 information.
Use delete[] for objects allocated with new[].
Version 6.2.6 (04-Jan-2015)
Fix build issue with GCC 4.2.1 on FreeBSD and Mac OS X (stop python defining isspace as a macro).
Remove support for python 3.1 (API's are unstable).
Add Python 3.3 support.
Patch from Michael Droettboom to fix compilation issues.
Patch from Michael Droettboom to add buffer interface for python3.
Version 6.2.4 (3-Mar-2012)
Fix memory leak in string encode and decode functions
Fix indirect python loading on windows - Bool_type was missing
Version 6.2.3 (11-Mar-2011)
Version 6.2.2 (26-Dec-2010)
Fix problem compiling against Python 3.1.3
Version 6.2.1 (3-May-2010)
Fix problems with new style classes
Replace all example makefile and project files with setup_makefile.py script.
Add APIs to make calling python functions easier. See TupleN(), callOnSelf(), self()
Version 6.1.1 (26-Sep-2009)
Supports Python 3 starting at Python 3.1 and Python 2
Code clean up to fix compiler warnings reported by gcc 4.2.1 on Mac OS X when building for Python 3.
Version 6.1.0 (19-Jul-2009)
Support Python 3 and Python 2
pysvn-1.9.22/Import/pycxx-7.1.9/build-limited-api.sh 000755 000765 000024 00000001214 14300500451 022165 0 ustar 00barry staff 000000 000000 #!/bin/bash
set -x
set -e
set -o pipefail
PYTHON=${1? python exe}
API=${2? api version}
shift 2
case "$( uname )" in
Darwin)
OS=macosx
;;
Linux):
OS=linux
;;
*)
echo Unknown OS assuming Linux
OS=linux
;;
esac
PYTHON_BASE=$(basename ${PYTHON})
TAG="${1}${2}${3}${4}"
${PYTHON} setup_makefile.py ${OS} tmp-${PYTHON_BASE}-limited-api-${API}${TAG}.mak --limited-api=${API} "${@}"
make -f tmp-${PYTHON_BASE}-limited-api-${API}${TAG}.mak clean 2>&1 | tee tmp-${PYTHON_BASE}-limited-api-${API}${TAG}.log
make -f tmp-${PYTHON_BASE}-limited-api-${API}${TAG}.mak test 2>&1 | tee -a tmp-${PYTHON_BASE}-limited-api-${API}${TAG}.log
pysvn-1.9.22/Import/pycxx-7.1.9/build-all.sh 000755 000765 000024 00000000047 14007527023 020552 0 ustar 00barry staff 000000 000000 #!/bin/bash
set -e
./build-all.py "$@"
pysvn-1.9.22/Import/pycxx-7.1.9/setup.py 000755 000765 000024 00000004741 13437177573 020111 0 ustar 00barry staff 000000 000000 import os, sys
from glob import glob
from distutils.command.install import install
from distutils.command.install_headers import install_headers
from distutils.core import setup
# either "Python2" or "Python3"
python_ver = "Python" + sys.version[0]
headers = [
(None, glob( os.path.join( "CXX", "*.hxx" ) ) + glob( os.path.join( "CXX", "*.h" ) )),
(python_ver, glob( os.path.join( "CXX", python_ver, "*.hxx" ) ))
]
sources = [
("CXX", glob( os.path.join( "Src", "*.cxx" ) ) + glob( os.path.join( "Src", "*.c" ) )),
(os.path.join( "CXX", python_ver ), glob( os.path.join( "Src", python_ver, "*" ) ))
]
class my_install(install):
def finalize_options( self ):
if not self.install_data or (len(self.install_data) < 8):
self.install_data = "$base/share/python$py_version_short"
install.finalize_options (self)
def run (self):
self.distribution.data_files = sources
self.distribution.headers = headers
install.run( self )
class my_install_headers(install_headers):
def run( self ):
if not self.distribution.headers:
return
for subdir, headers in self.distribution.headers:
try:
dir = os.path.join( self.install_dir, subdir )
except:
dir = self.install_dir
self.mkpath( dir )
for header in headers:
(out, _) = self.copy_file( header, dir )
self.outfiles.append( out )
# read the version from the master file CXX/Version.hxx
v_maj = None
v_min = None
v_pat = None
with open( 'CXX/Version.hxx', 'r' ) as f:
for line in f:
if line.startswith( '#define PYCXX_VERSION_' ):
parts = line.strip().split()
if parts[1] == 'PYCXX_VERSION_MAJOR':
v_maj = parts[2]
elif parts[1] == 'PYCXX_VERSION_MINOR':
v_min = parts[2]
elif parts[1] == 'PYCXX_VERSION_PATCH':
v_pat = parts[2]
setup( name = "CXX",
version = "%s.%s.%s" % (v_maj, v_min, v_pat),
maintainer = "Barry Scott",
maintainer_email = "barry-scott@users.sourceforge.net",
description = "Facility for extending Python with C++",
url = "http://cxx.sourceforge.net",
cmdclass = {'install': my_install,
'install_headers': my_install_headers},
packages = ['CXX'],
package_dir = {'CXX': 'Lib'}
)
pysvn-1.9.22/Import/pycxx-7.1.9/Lib/ 000755 000765 000024 00000000000 14477104307 017062 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/build-limited-api.cmd 000644 000765 000024 00000003573 14305137454 022343 0 ustar 00barry staff 000000 000000 setlocal
rem M.m e.g. 2.7 3.6 etc
set PYTHON_VER=%1
rem 32 or 64
set PYTHON_ARCH=%2
rem 10.0, 14.0, 2017
set VC_VER=%3
rem 3.5 etc
set API=%4
echo ------------------------------------------------------
echo Testing limited API %4 for python %1 %2 using VC %3
echo ------------------------------------------------------
if %PYTHON_ARCH% == win32 (
set PYTHON_VER_ARCH=%PYTHON_VER%-32
if exist "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\vcvarsall.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\vcvarsall.bat"
)
if exist "c:\Program Files (x86)\Microsoft Visual Studio\%VC_VER%\Community\VC\Auxiliary\Build\vcvars32.bat" (
call "c:\Program Files (x86)\Microsoft Visual Studio\%VC_VER%\Community\VC\Auxiliary\Build\vcvars32.bat"
)
)
if %PYTHON_ARCH% == win64 (
set PYTHON_VER_ARCH=%PYTHON_VER%-64
if exist "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\bin\amd64\vcvars64.bat" (
call "C:\Program Files (x86)\Microsoft Visual Studio %VC_VER%\VC\bin\amd64\vcvars64.bat"
)
if exist "c:\Program Files (x86)\Microsoft Visual Studio\%VC_VER%\Community\VC\Auxiliary\Build\vcvars64.bat" (
call "c:\Program Files (x86)\Microsoft Visual Studio\%VC_VER%\Community\VC\Auxiliary\Build\vcvars64.bat"
)
)
py -%PYTHON_VER_ARCH% setup_makefile.py %PYTHON_ARCH% tmp-%PYTHON_ARCH%-python%PYTHON_VER%-limited-%API%-build.mak --limited-api=%API%
if errorlevel 1 exit /b 1
nmake -f tmp-%PYTHON_ARCH%-python%PYTHON_VER%-limited-%API%-build.mak clean all 2>&1 | py -3 build_tee.py tmp-%PYTHON_ARCH%-python%PYTHON_VER%-limited-%API%-build.log
if not exist obj\pycxx_iter.pyd exit /b 1
nmake -f tmp-%PYTHON_ARCH%-python%PYTHON_VER%-limited-%API%-build.mak test 2>&1 | py -3 build_tee.py -a tmp-%PYTHON_ARCH%-python%PYTHON_VER%-limited-%API%-test.log
echo All done
endlocal
pysvn-1.9.22/Import/pycxx-7.1.9/how_to_release_pycxx.txt 000644 000765 000024 00000001624 13510630011 023331 0 ustar 00barry staff 000000 000000 How to release PyCXX
--------------------
0. Update CXX/Version.hxx with the releases version number
Update README.html, README.txt with change log info
1. Tag the source using tag_pycxx.py (depends on pysvn).
2. Create the source kit using make_src_kit.py
3. Add new File release on sourceforge.
1. http://sourceforge.net/projects/cxx/
2. Select Files tab
3. Open CXX folder
4. Click "Add Folder"
5. Name the Folder PyCXX V.. e.g. PyCXX V6.1.1
7. Upload the source kit and its README.txt
9. Click on the source kit (i) icon and choose Select All platforms. Do not select all for README.txt.
4. Add news about release
1. Click News
2. From side bar choose New Post
3. Add news with release note info - may be need to make it a bigger advert?
5. Email CXX mailing lists
6. Update docs on the PyCXX homepage
1. cd SourceForge
2. ./deploy.sh
pysvn-1.9.22/Import/pycxx-7.1.9/RegressionTests/ 000755 000765 000024 00000000000 14477104307 021517 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/Doc/ 000755 000765 000024 00000000000 14477104307 017061 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/README.txt 000644 000765 000024 00000001016 14477044572 020057 0 ustar 00barry staff 000000 000000 Version: 7.1.9 (9-Sep-2023)
Add support for building against python 3.12 RC2
The following functions have been remove from 3.12 builds:
int &_Py_DebugFlag()
int &_Py_InteractiveFlag()
int &_Py_OptimizeFlag()
int &_Py_NoSiteFlag()
int &_Py_VerboseFlag()
They depend on deprecated variables:
Py_DebugFlag, Py_InteractiveFlag, Py_OptimizeFlag
Py_NoSiteFlag, Py_VerboseFlag
If the value of these variables is needed they can be accessed
from sys.flags.
_Py_PackageContext is no longer accessible.
pysvn-1.9.22/Import/pycxx-7.1.9/COPYRIGHT 000644 000765 000024 00000006226 10547732521 017654 0 ustar 00barry staff 000000 000000
Copyright (c) 1998 - 2007
The Regents of the University of California
Produced at the Lawrence Livermore National Laboratory
Written by Geoff Furnish, Paul F. Dubois, Barry A. Scott
UCRL-CODE-227018
All rights reserved.
This file is part of PyCXX. For details, see http://cxx.sourceforge.net.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
- Redistributions of source code must retain the above copyright notice, this
list of conditions and the disclaimer below.
- Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the disclaimer (as noted below) in the
documentation and/or materials provided with the distribution.
- Neither the name of the UC/LLNL nor the names of its contributors may be
used to endorse or promote products derived from this software without
specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF CALIFORNIA,
THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY
OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
Additional BSD Notice
1. This notice is required to be provided under our contract with the U.S.
Department of Energy (DOE). This work was produced at the University of
California, Lawrence Livermore National Laboratory under Contract No.
W-7405-ENG-48 with the DOE.
2. Neither the United States Government nor the University of California
nor any of their employees, makes any warranty, express or implied, or
assumes any liability or responsibility for the accuracy, completeness,
or usefulness of any information, apparatus, product, or process disclosed,
or represents that its use would not infringe privately-owned rights.
3. Also, reference herein to any specific commercial products, process, or
services by trade name, trademark, manufacturer or otherwise does not
necessarily constitute or imply its endorsement, recommendation, or
favoring by the United States Government or the University of California.
The views and opinions of authors expressed herein do not necessarily
state or reflect those of the United States Government or the University
of California, and shall not be used for advertising or product endorsement
purposes.
pysvn-1.9.22/Import/pycxx-7.1.9/build_tee.py 000644 000765 000024 00000001226 14007527023 020654 0 ustar 00barry staff 000000 000000 #!/usr/bin/env python3
import sys
import re
def main( argv ):
all_copies = []
i_args = iter( argv )
next( i_args )
mode = 'w'
for filename in i_args:
if filename == '-a':
mode = 'a'
else:
all_copies.append( open( filename, 'w' ) )
colour = re.compile( r'\033\[[\d;]*m' )
for line in sys.stdin:
# allow colours to be shown seen
sys.stdout.write( line )
# remove colouring from log files.
line = colour.sub( '', line )
for copy in all_copies:
copy.write( line )
return 0
if __name__ == '__main__':
sys.exit( main( sys.argv ) )
pysvn-1.9.22/Import/pycxx-7.1.9/setup_makefile.py 000644 000765 000024 00000064430 14477061356 021740 0 ustar 00barry staff 000000 000000 #
# Copyright (c) 2010-2011 Barry A. Scott
#
import os
import sys
import sysconfig
import subprocess
_debug = False
def debug( msg ):
if _debug:
sys.stderr.write( 'Debug: %s\n' % (msg,) )
#--------------------------------------------------------------------------------
class Setup:
def __init__( self, argv ):
global _debug
args = iter(argv)
next(args)
self.opt_pycxx_debug = False
self.opt_limited_api = None
self.opt_warnings_as_errors = False
self.opt_cpp_std = None
self.opt_cc_std = None
self.is_pypy = hasattr( sys, 'pypy_version_info' )
positional_args = []
for arg in args:
if arg == '--debug':
_debug = True
elif arg == '--pycxx-debug':
self.opt_pycxx_debug = True
elif arg == '--limited-api':
self.opt_limited_api = '0x03040000'
elif arg.startswith( '--limited-api=' ):
api = arg[len('--limited-api='):]
if api.startswith( '0x' ):
self.opt_limited_api = api
else:
major, minor = [int(s) for s in api.split('.')]
minor *= 0x10000
major *= 0x1000000
self.opt_limited_api = '0x%x' % (major+minor)
elif arg.startswith( '--c++-std=' ):
self.opt_cpp_std = arg[len('--c++-std='):]
elif arg.startswith( '--c-std=' ):
self.opt_cc_std = arg[len('--c-std='):]
elif arg == '--warnings-as-errors':
self.opt_warnings_as_errors = True
elif arg.startswith( '--' ):
raise ValueError( 'Unknown arg %r' % (arg,) )
else:
positional_args.append( arg )
if len(positional_args) != 2:
raise ValueError( 'Usage: setup_makefile.py win32|win64|macosx|linux> ' )
self.platform, makefile = positional_args
self.__makefile = open( makefile, 'wt' )
self.setupCompile()
def makePrint( self, line ):
self.__makefile.write( line )
self.__makefile.write( '\n' )
def setupCompile( self ):
if self.platform == 'win32':
self.c_utils = Win32CompilerMSVC90( self )
self.c_python_extension = Win32CompilerMSVC90( self )
elif self.platform == 'win64':
self.c_utils = Win32CompilerMSVC90( self )
self.c_python_extension = Win32CompilerMSVC90( self )
elif self.platform == 'macosx':
self.c_utils = MacOsxCompilerGCC( self )
self.c_python_extension = MacOsxCompilerGCC( self )
elif self.platform == 'linux':
self.c_utils = LinuxCompilerGCC( self )
self.c_python_extension = LinuxCompilerGCC( self )
else:
raise ValueError( 'Unknown platform %r' % (self.platform,) )
self.c_python_extension.setupPythonExtension()
self.pycxx_obj_file = [
Source( self.c_python_extension, 'Src/cxxsupport.cxx' ),
Source( self.c_python_extension, 'Src/cxx_extensions.cxx' ),
Source( self.c_python_extension, 'Src/cxx_exceptions.cxx' ),
Source( self.c_python_extension, 'Src/cxxextensions.c' ),
Source( self.c_python_extension, 'Src/IndirectPythonInterface.cxx' ),
]
self.simple_obj_files = [
Source( self.c_python_extension, '%(DEMO_DIR)s/simple.cxx' ),
] + self.pycxx_obj_file
self.example_obj_files = [
Source( self.c_python_extension, '%(DEMO_DIR)s/example.cxx' ),
Source( self.c_python_extension, '%(DEMO_DIR)s/range.cxx' ),
Source( self.c_python_extension, '%(DEMO_DIR)s/rangetest.cxx' ),
] + self.pycxx_obj_file
self.pycxx_iter_obj_files = [
Source( self.c_python_extension, '%(DEMO_DIR)s/pycxx_iter.cxx' ),
] + self.pycxx_obj_file
exe_simple = PythonExtension( self.c_python_extension, 'simple', self.simple_obj_files )
exe_example = PythonExtension( self.c_python_extension, 'example', self.example_obj_files )
exe_pycxx_iter = PythonExtension( self.c_python_extension, 'pycxx_iter', self.pycxx_iter_obj_files )
self.all_exe = [
exe_simple,
exe_example,
exe_pycxx_iter,
]
self.all_test = [
TestPythonExtension( self.c_python_extension, '%(DEMO_DIR)s/test_simple.py', exe_simple ),
TestPythonExtension( self.c_python_extension, '%(DEMO_DIR)s/test_example.py', exe_example ),
TestPythonExtension( self.c_python_extension, '%(DEMO_DIR)s/test_pycxx_iter.py', exe_pycxx_iter ),
]
def generateMakefile( self ):
try:
self.c_python_extension.generateMakefileHeader()
self.makePrint( 'all: %s' % (' '.join( [exe.getTargetFilename() for exe in self.all_exe] )) )
self.makePrint( '' )
for exe in self.all_exe:
exe.generateMakefile()
for test in self.all_test:
test.generateMakefile()
self.__makefile.close()
return 0
except ValueError:
e = sys.exc_info()[1]
sys.stderr.write( 'Error: %s\n' % (e,) )
return 1
#--------------------------------------------------------------------------------
class Compiler:
def __init__( self, setup ):
debug( 'Compiler.__init__()' )
self.setup = setup
self.__variables = {}
self._addVar( 'DEBUG', 'NDEBUG')
def platformFilename( self, filename ):
return filename
def makePrint( self, line ):
self.setup.makePrint( line )
def generateMakefileHeader( self ):
raise NotImplementedError( 'generateMakefileHeader' )
def _addFromEnv( self, name ):
debug( 'Compiler._addFromEnv( %r )' % (name,) )
self._addVar( name, os.environ[ name ] )
def _addVar( self, name, value ):
debug( 'Compiler._addVar( %r, %r )' % (name, value) )
try:
if '%' in value:
value = value % self.__variables
self.__variables[ name ] = value
except TypeError:
raise ValueError( 'Cannot translate name %r value %r' % (name, value) )
except KeyError:
e = sys.exc_info()[1]
raise ValueError( 'Cannot translate name %r value %r - %s' % (name, value, e) )
def expand( self, s ):
try:
return s % self.__variables
except (TypeError, KeyError):
e = sys.exc_info()[1]
print( 'Error: %s' % (e,) )
print( 'String: %s' % (s,) )
print( 'Vairables: %r' % (self.__variables,) )
raise ValueError( 'Cannot translate string (%s)' % (e,) )
# MSVC 9.0 and later versions
class Win32CompilerMSVC90(Compiler):
def __init__( self, setup ):
Compiler.__init__( self, setup )
self._addVar( 'PYTHONDIR', sys.exec_prefix )
if setup.opt_limited_api is None:
self._addVar( 'PYTHON_LIBNAME', 'python%d%d' % (sys.version_info[0], sys.version_info[1]) )
else:
self._addVar( 'PYTHON_LIBNAME', 'python3' )
self._addVar( 'PYTHON_INCLUDE', r'%(PYTHONDIR)s\include' )
self._addVar( 'PYTHON_LIB', r'%(PYTHONDIR)s\libs' )
self._addVar( 'PYTHON', sys.executable )
def platformFilename( self, filename ):
return filename.replace( '/', '\\' )
def getPythonExtensionFileExt( self ):
return '.pyd'
def getProgramExt( self ):
return '.exe'
def generateMakefileHeader( self ):
self.makePrint( '#' )
self.makePrint( '# PyCXX Makefile generated by setup_makefile.py' )
self.makePrint( '#' )
self.makePrint( 'CCC=cl /nologo /W4' )
self.makePrint( 'CC=cl /nologo /W4' )
self.makePrint( '' )
self.makePrint( 'LDSHARED=$(CCC) /LD /Zi /MT /EHsc' )
self.makePrint( 'LDEXE=$(CCC) /Zi /MT /EHsc' )
self.makePrint( '' )
def ruleLinkProgram( self, target ):
pyd_filename = target.getTargetFilename()
pdf_filename = target.getTargetFilename( '.pdf' )
all_objects = [source.getTargetFilename() for source in target.all_sources]
rules = ['']
rules.append( '' )
rules.append( '%s : %s' % (pyd_filename, ' '.join( all_objects )) )
rules.append( '\t@echo Link %s' % (pyd_filename,) )
rules.append( '\t$(LDEXE) %%(CCCFLAGS)s /Fe%s /Fd%s %s Advapi32.lib' %
(pyd_filename, pdf_filename, ' '.join( all_objects )) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleLinkShared( self, target ):
pyd_filename = target.getTargetFilename()
pdf_filename = target.getTargetFilename( '.pdf' )
all_objects = [source.getTargetFilename() for source in target.all_sources]
rules = ['']
rules.append( '' )
rules.append( '%s : %s' % (pyd_filename, ' '.join( all_objects )) )
rules.append( '\t@echo Link %s' % (pyd_filename,) )
rules.append( '\t$(LDSHARED) %%(CCCFLAGS)s /Fe%s /Fd%s %s %%(PYTHON_LIB)s\\%%(PYTHON_LIBNAME)s.lib' %
(pyd_filename, pdf_filename, ' '.join( all_objects )) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleCxx( self, target ):
obj_filename = target.getTargetFilename()
rules = []
rules.append( '%s: %s %s' % (obj_filename, target.src_filename, ' '.join( target.all_dependencies )) )
rules.append( '\t@echo Compile: %s into %s' % (target.src_filename, target.getTargetFilename()) )
rules.append( '\t$(CCC) /c %%(CCCFLAGS)s /Fo%s /Fd%s %s' % (obj_filename, target.dependent.getTargetFilename( '.pdb' ), target.src_filename) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleC( self, target ):
obj_filename = target.getTargetFilename()
rules = []
rules.append( '%s: %s %s' % (obj_filename, target.src_filename, ' '.join( target.all_dependencies )) )
rules.append( '\t@echo Compile: %s into %s' % (target.src_filename, target.getTargetFilename()) )
rules.append( '\t$(CC) /c %%(CCFLAGS)s /Fo%s /Fd%s %s' % (obj_filename, target.dependent.getTargetFilename( '.pdb' ), target.src_filename) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleClean( self, filename ):
rules = []
rules.append( 'clean::' )
rules.append( '\tif exist %s del %s' % (filename, filename) )
rules.append( '' )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def setupPythonExtension( self ):
self._addVar( 'PYTHON', sys.executable )
self._addVar( 'OBJ_DIR', 'obj' )
self._addVar( 'PYTHON_VERSION', '%d.%d' % (sys.version_info[0], sys.version_info[1]) )
self._addVar( 'DEMO_DIR', 'Demo\\Python%d' % (sys.version_info[0],) )
self._addVar( 'PYCXX_DEBUG', '-DPYCXX_DEBUG=1' if self.setup.opt_pycxx_debug else '' )
self._addVar( 'PYCXX_API', ('-DPy_LIMITED_API=%s' % (self.setup.opt_limited_api,)) if self.setup.opt_limited_api else '' )
self._addVar( 'CCCFLAGS',
r'/Zi /MT /EHsc '
r'-I. -ISrc -I%(PYTHON_INCLUDE)s '
r'-D_CRT_NONSTDC_NO_DEPRECATE '
r'-U_DEBUG '
r'-D%(DEBUG)s '
r'%(PYCXX_DEBUG)s'
r'%(PYCXX_API)s' )
self._addVar( 'CCFLAGS',
r'/Zi /MT '
r'-I. -ISrc -I%(PYTHON_INCLUDE)s '
r'-D_CRT_NONSTDC_NO_DEPRECATE '
r'-U_DEBUG '
r'-D%(DEBUG)s '
r'%(PYCXX_DEBUG)s'
r'%(PYCXX_API)s' )
def ruleTest( self, python_test ):
rules = []
rules.append( 'test:: %s %s' % (python_test.getTargetFilename(), python_test.python_extension.getTargetFilename()) )
rules.append( '\tset PYTHONPATH=obj' )
rules.append( '\t%%(PYTHON)s -W default %s' % (python_test.getTargetFilename(),) )
rules.append( '' )
self.makePrint( self.expand( '\n'.join( rules ) ) )
class CompilerGCC(Compiler):
def __init__( self, setup ):
Compiler.__init__( self, setup )
def getPythonExtensionFileExt( self ):
return '.so'
def getProgramExt( self ):
return ''
def generateMakefileHeader( self ):
self.makePrint( '#' )
self.makePrint( '# PyCXX Makefile generated by setup_makefile.py' )
self.makePrint( '#' )
self.makePrint( '' )
def ruleLinkProgram( self, target ):
target_filename = target.getTargetFilename()
all_objects = [source.getTargetFilename() for source in target.all_sources]
rules = []
rules.append( '%s : %s' % (target_filename, ' '.join( all_objects )) )
rules.append( '\t@echo Link %s' % (target_filename,) )
rules.append( '\t%%(LDEXE)s -o %s %%(CCFLAGS)s %s' % (target_filename, ' '.join( all_objects )) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleLinkShared( self, target ):
target_filename = target.getTargetFilename()
all_objects = [source.getTargetFilename() for source in target.all_sources]
rules = []
rules.append( '%s : %s' % (target_filename, ' '.join( all_objects )) )
rules.append( '\t@echo Link %s' % (target_filename,) )
rules.append( '\t%%(LDSHARED)s -o %s %%(CCFLAGS)s %s' % (target_filename, ' '.join( all_objects )) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleCxx( self, target ):
obj_filename = target.getTargetFilename()
rules = []
rules.append( '%s: %s %s' % (obj_filename, target.src_filename, ' '.join( target.all_dependencies )) )
rules.append( '\t@echo Compile: %s into %s' % (target.src_filename, obj_filename) )
rules.append( '\t%%(CCC)s -c %%(CCCFLAGS)s -o%s %s' % (obj_filename, target.src_filename) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleC( self, target ):
obj_filename = target.getTargetFilename()
rules = []
rules.append( '%s: %s %s' % (obj_filename, target.src_filename, ' '.join( target.all_dependencies )) )
rules.append( '\t@echo Compile: %s into %s' % (target.src_filename, obj_filename) )
rules.append( '\t%%(CC)s -c %%(CCCFLAGS)s -o%s %s' % (obj_filename, target.src_filename) )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleClean( self, filename ):
rules = []
rules.append( 'clean::' )
rules.append( '\trm -f %s' % (filename,) )
rules.append( '' )
self.makePrint( self.expand( '\n'.join( rules ) ) )
def ruleTest( self, python_test ):
rules = []
rules.append( 'test:: %s %s' % (python_test.getTargetFilename(), python_test.python_extension.getTargetFilename()) )
rules.append( '\tPYTHONPATH=obj %%(PYTHON)s -W default %s' % (python_test.getTargetFilename(),) )
rules.append( '' )
self.makePrint( self.expand( '\n'.join( rules ) ) )
class MacOsxCompilerGCC(CompilerGCC):
def __init__( self, setup ):
CompilerGCC.__init__( self, setup )
if sys.version_info[0] == 2:
maxsize = sys.maxint
else:
maxsize = sys.maxsize
r = subprocess.run( ['lipo', '-archs', sys.executable], capture_output=True )
all_archs = r.stdout.decode('utf-8').strip().split()
self._addVar( 'CCC', 'g++ %s' % (' '.join('-arch %s' % (a,) for a in all_archs),) )
self._addVar( 'CC', 'gcc %s' % (' '.join('-arch %s' % (a,) for a in all_archs),) )
def setupPythonExtension( self ):
self._addVar( 'PYTHON', sys.executable )
self._addVar( 'OBJ_DIR', 'obj' )
self._addVar( 'PYTHON_VERSION', '%d.%d' % (sys.version_info[0], sys.version_info[1]) )
self._addVar( 'PYTHONDIR', sys.exec_prefix )
self._addVar( 'PYTHON', sys.executable )
if self.setup.is_pypy:
self._addVar( 'PYTHON_INCLUDE', '%(PYTHONDIR)s/include' )
self._addVar( 'PYTHON_FRAMEWORK', '%(PYTHONDIR)s/bin/libpypy-c.dylib' )
else:
self._addVar( 'PYTHON_INCLUDE', '%(PYTHONDIR)s/Headers' )
self._addVar( 'PYTHON_FRAMEWORK', '%(PYTHONDIR)s/Python' )
self._addVar( 'DEMO_DIR', 'Demo/Python%d' % (sys.version_info[0],) )
self._addVar( 'PYCXX_DEBUG', '-DPYCXX_DEBUG=1' if self.setup.opt_pycxx_debug else '' )
self._addVar( 'PYCXX_API', ('-DPy_LIMITED_API=%s' % (self.setup.opt_limited_api,)) if self.setup.opt_limited_api else '' )
self._addVar( 'WARN_AS_ERROR', '-Werror' if self.setup.opt_warnings_as_errors else '' )
self._addVar( 'CPP_STD', '-std=%s' % (self.setup.opt_cpp_std,) if self.setup.opt_cpp_std is not None else '' )
self._addVar( 'CC_STD', '-std=%s' % (self.setup.opt_cc_std,) if self.setup.opt_cc_std is not None else '' )
self._addVar( 'CCCFLAGS',
'-g '
'-Wall -fPIC -fexceptions -frtti '
'-I. -ISrc -I%(PYTHON_INCLUDE)s '
'-D%(DEBUG)s '
'%(WARN_AS_ERROR)s '
'%(CPP_STD)s '
'%(PYCXX_DEBUG)s'
'%(PYCXX_API)s' )
self._addVar( 'CCFLAGS',
'-g '
'-Wall -fPIC '
'-I. -ISrc -I%(PYTHON_INCLUDE)s '
'-D%(DEBUG)s '
'-Werror '
'%(PYCXX_DEBUG)s'
'%(PYCXX_API)s' )
self._addVar( 'CCCFLAGS',
'-g '
'-Wall -fPIC -fexceptions -frtti '
'-I. -ISrc -I%(PYTHON_INCLUDE)s '
'-D%(DEBUG)s '
'%(WARN_AS_ERROR)s '
'%(CPP_STD)s '
'%(PYCXX_DEBUG)s'
'%(PYCXX_API)s' )
self._addVar( 'CCFLAGS',
'-g '
'-Wall -fPIC '
'-I. -ISrc -I%(PYTHON_INCLUDE)s '
'-D%(DEBUG)s '
'%(WARN_AS_ERROR)s '
'%(CC_STD)s '
'%(PYCXX_DEBUG)s'
'%(PYCXX_API)s' )
self._addVar( 'LDSHARED', '%(CCC)s -bundle -g '
'-framework System '
'%(PYTHON_FRAMEWORK)s ' )
class LinuxCompilerGCC(CompilerGCC):
def __init__( self, setup ):
CompilerGCC.__init__( self, setup )
self._addVar( 'CCC', 'g++' )
self._addVar( 'CC', 'gcc' )
def setupPythonExtension( self ):
self._addVar( 'PYTHON', sys.executable )
self._addVar( 'OBJ_DIR', 'obj' )
self._addVar( 'DEMO_DIR', 'Demo/Python%d' % (sys.version_info[0],) )
self._addVar( 'PYTHON_VERSION', '%d.%d' % (sys.version_info[0], sys.version_info[1]) )
self._addVar( 'PYTHON_INCLUDE', sysconfig.get_path( 'include' ) )
self._addVar( 'PYCXX_DEBUG', '-DPYCXX_DEBUG=1' if self.setup.opt_pycxx_debug else '' )
self._addVar( 'PYCXX_API', ('-DPy_LIMITED_API=%s' % (self.setup.opt_limited_api,)) if self.setup.opt_limited_api else '' )
self._addVar( 'WARN_AS_ERROR', '-Werror' if self.setup.opt_warnings_as_errors else '' )
self._addVar( 'CPP_STD', '-std=%s' % (self.setup.opt_cpp_std,) if self.setup.opt_cpp_std is not None else '' )
self._addVar( 'CC_STD', '-std=%s' % (self.setup.opt_cc_std,) if self.setup.opt_cc_std is not None else '' )
self._addVar( 'CCCFLAGS',
'-g '
'-Wall -fPIC -fexceptions -frtti '
'-I. -ISrc -I%(PYTHON_INCLUDE)s '
'-D%(DEBUG)s '
'%(WARN_AS_ERROR)s '
'%(CPP_STD)s '
'%(PYCXX_DEBUG)s '
'%(PYCXX_API)s ' )
self._addVar( 'CCFLAGS',
'-g '
'-Wall -fPIC '
'-I. -ISrc -I%(PYTHON_INCLUDE)s '
'-D%(DEBUG)s '
'%(WARN_AS_ERROR)s '
'%(CC_STD)s '
'%(PYCXX_DEBUG)s'
'%(PYCXX_API)s' )
self._addVar( 'LDEXE', '%(CCC)s -g' )
self._addVar( 'LDSHARED', '%(CCC)s -shared -g ' )
#--------------------------------------------------------------------------------
class Target:
def __init__( self, compiler, all_sources ):
self.compiler = compiler
self.__generated = False
self.dependent = None
self.all_sources = all_sources
for source in self.all_sources:
source.setDependent( self )
def getTargetFilename( self ):
raise NotImplementedError( '%s.getTargetFilename' % self.__class__.__name__ )
def generateMakefile( self ):
if self.__generated:
return
self.__generated = True
return self._generateMakefile()
def _generateMakefile( self ):
raise NotImplementedError( '_generateMakefile' )
def ruleClean( self, ext=None ):
if ext is None:
target_filename = self.getTargetFilename()
else:
target_filename = self.getTargetFilename( ext )
self.compiler.ruleClean( target_filename )
def setDependent( self, dependent ):
debug( '%r.setDependent( %r )' % (self, dependent,) )
self.dependent = dependent
class TestPythonExtension(Target):
def __init__( self, compiler, test_source, python_extension ):
self.test_source = test_source
self.python_extension = python_extension
Target.__init__( self, compiler, [] )
def __repr__( self ):
return '' % (id(self), self.test_source )
def getTargetFilename( self ):
return self.compiler.platformFilename( self.compiler.expand( self.test_source ) )
def _generateMakefile( self ):
self.compiler.ruleTest( self )
class PythonExtension(Target):
def __init__( self, compiler, output, all_sources ):
self.output = output
Target.__init__( self, compiler, all_sources )
debug( 'PythonExtension:0x%8.8x.__init__( %r, ... )' % (id(self), output,) )
for source in self.all_sources:
source.setDependent( self )
def __repr__( self ):
return '' % (id(self), self.output)
def getTargetFilename( self, ext=None ):
if ext is None:
ext = self.compiler.getPythonExtensionFileExt()
return self.compiler.platformFilename( self.compiler.expand( '%%(OBJ_DIR)s/%s%s' % (self.output, ext) ) )
def _generateMakefile( self ):
debug( 'PythonExtension:0x%8.8x.generateMakefile() for %r' % (id(self), self.output,) )
self.compiler.ruleLinkShared( self )
self.compiler.ruleClean( self.getTargetFilename( '.*' ) )
for source in self.all_sources:
source.generateMakefile()
class Source(Target):
def __init__( self, compiler, src_filename, all_dependencies=None ):
self.src_filename = compiler.platformFilename( compiler.expand( src_filename ) )
Target.__init__( self, compiler, [] )
debug( 'Source:0x%8.8x.__init__( %r, %r )' % (id(self), src_filename, all_dependencies) )
self.all_dependencies = all_dependencies
if self.all_dependencies is None:
self.all_dependencies = []
def __repr__( self ):
return '' % (id(self), self.src_filename)
def getTargetFilename( self ):
#if not os.path.exists( self.src_filename ):
# raise ValueError( 'Cannot find source %s' % (self.src_filename,) )
basename = os.path.basename( self.src_filename )
if basename.endswith( '.cpp' ):
return self.compiler.platformFilename( self.compiler.expand( r'%%(OBJ_DIR)s/%s.obj' % (basename[:-len('.cpp')],) ) )
if basename.endswith( '.cxx' ):
return self.compiler.platformFilename( self.compiler.expand( r'%%(OBJ_DIR)s/%s.obj' % (basename[:-len('.cxx')],) ) )
if basename.endswith( '.c' ):
return self.compiler.platformFilename( self.compiler.expand( r'%%(OBJ_DIR)s/%s.obj' % (basename[:-len('.c')],) ) )
raise ValueError( 'unknown source %r' % (self.src_filename,) )
def _generateMakefile( self ):
debug( 'Source:0x%8.8x.generateMakefile() for %r' % (id(self), self.src_filename,) )
if self.src_filename.endswith( '.c' ):
self.compiler.ruleC( self )
else:
self.compiler.ruleCxx( self )
self.compiler.ruleClean( self.getTargetFilename() )
#--------------------------------------------------------------------------------
def main( argv ):
try:
s = Setup( argv )
s.generateMakefile()
return 0
except ValueError:
e = sys.exc_info()[1]
sys.stderr.write( 'Error: %s\n' % (e,) )
return 1
if __name__ == '__main__':
sys.exit( main( sys.argv ) )
pysvn-1.9.22/Import/pycxx-7.1.9/run_tests.cmd 000644 000765 000024 00000000473 11146621572 021071 0 ustar 00barry staff 000000 000000 setlocal
set PY_MAJ=2
if not "%1" == "" set PY_MAJ=%1
set PY_MIN=5
if not "%2" == "" set PY_MIN=%2
set PYTHONPATH=pyds%PY_MAJ%%PY_MIN%
c:\python%PY_MAJ%%PY_MIN%\python Demo\test_example.py
if exist pyds%PY_MAJ%%PY_MIN%\pycxx_iter.pyd c:\python%PY_MAJ%%PY_MIN%\python Demo\test_pycxx_iter.py
endlocal
pysvn-1.9.22/Import/pycxx-7.1.9/build-c++-std-checking.sh 000755 000765 000024 00000000252 14300500451 022701 0 ustar 00barry staff 000000 000000 #!/bin/bash
for STD in gnu++98 c++98 gnu++03 c++03 gnu++11 c++11 gnu++14 c++14 gnu++17 c++17 gnu++20 c++20
do
./build-all.sh --c++-std=${STD} 3.8 3.9 3.10 3.11
done
pysvn-1.9.22/Import/pycxx-7.1.9/Src/ 000755 000765 000024 00000000000 14477104307 017103 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/Src/cxxextensions.c 000644 000765 000024 00000004356 11146072165 022175 0 ustar 00barry staff 000000 000000 //-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/WrapPython.h"
#if PY_MAJOR_VERSION == 2
#include "Src/Python2/cxxextensions.c"
#else
#include "Src/Python3/cxxextensions.c"
#endif
pysvn-1.9.22/Import/pycxx-7.1.9/Src/Python3/ 000755 000765 000024 00000000000 14477104307 020447 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/Src/cxxsupport.cxx 000644 000765 000024 00000004354 11146072165 022070 0 ustar 00barry staff 000000 000000 //-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/WrapPython.h"
#if PY_MAJOR_VERSION == 2
#include "Src/Python2/cxxsupport.cxx"
#else
#include "Src/Python3/cxxsupport.cxx"
#endif
pysvn-1.9.22/Import/pycxx-7.1.9/Src/Python2/ 000755 000765 000024 00000000000 14477104307 020446 5 ustar 00barry staff 000000 000000 pysvn-1.9.22/Import/pycxx-7.1.9/Src/cxx_exceptions.cxx 000644 000765 000024 00000000220 12721375410 022657 0 ustar 00barry staff 000000 000000 #include "CXX/WrapPython.h"
#if PY_MAJOR_VERSION == 2
#include "Python2/cxx_exceptions.cxx"
#else
#include "Python3/cxx_exceptions.cxx"
#endif
pysvn-1.9.22/Import/pycxx-7.1.9/Src/cxx_extensions.cxx 000644 000765 000024 00000004354 11146072165 022712 0 ustar 00barry staff 000000 000000 //-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/WrapPython.h"
#if PY_MAJOR_VERSION == 2
#include "Python2/cxx_extensions.cxx"
#else
#include "Python3/cxx_extensions.cxx"
#endif
pysvn-1.9.22/Import/pycxx-7.1.9/Src/IndirectPythonInterface.cxx 000644 000765 000024 00000054071 14477044572 024431 0 ustar 00barry staff 000000 000000 //-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/IndirectPythonInterface.hxx"
namespace Py
{
static int _IsInstance( PyObject *op, PyTypeObject *type )
{
return PyObject_IsInstance( op, reinterpret_cast( type ) );
}
bool _CFunction_Check( PyObject *op ) { return _IsInstance( op, _CFunction_Type() ) > 0; }
bool _Complex_Check( PyObject *op ) { return _IsInstance( op, _Complex_Type() ) > 0; }
bool _Dict_Check( PyObject *op ) { return _IsInstance( op, _Dict_Type() ) > 0; }
bool _Float_Check( PyObject *op ) { return _IsInstance( op, _Float_Type() ) > 0; }
#if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
bool _Function_Check( PyObject *op ) { return _IsInstance( op, _Function_Type() ) > 0; }
#endif
bool _Boolean_Check( PyObject *op ) { return _IsInstance( op, _Bool_Type() ) > 0; }
bool _List_Check( PyObject *op ) { return _IsInstance( op, _List_Type() ) > 0; }
bool _Long_Check( PyObject *op ) { return _IsInstance( op, _Long_Type() ) > 0; }
#if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
bool _Method_Check( PyObject *op ) { return _IsInstance( op, _Method_Type() ) > 0; }
#endif
bool _Module_Check( PyObject *op ) { return _IsInstance( op, _Module_Type() ) > 0; }
bool _Range_Check( PyObject *op ) { return _IsInstance( op, _Range_Type() ) > 0; }
bool _Slice_Check( PyObject *op ) { return _IsInstance( op, _Slice_Type() ) > 0; }
bool _TraceBack_Check( PyObject *op ) { return _IsInstance( op, _TraceBack_Type() ) > 0; }
bool _Tuple_Check( PyObject *op ) { return _IsInstance( op, _Tuple_Type() ) > 0; }
bool _Type_Check( PyObject *op ) { return _IsInstance( op, _Type_Type() ) > 0; }
bool _Unicode_Check( PyObject *op ) { return _IsInstance( op, _Unicode_Type() ) > 0; }
#if PY_MAJOR_VERSION == 2
bool _String_Check( PyObject *op ) { return _IsInstance( op, _String_Type() ) > 0; }
bool _Int_Check( PyObject *op ) { return _IsInstance( op, _Int_Type() ) > 0; }
bool _CObject_Check( PyObject *op ) { return _IsInstance( op, _CObject_Type() ) > 0; }
#endif
#if PY_MAJOR_VERSION >= 3
bool _Bytes_Check( PyObject *op ) { return _IsInstance( op, _Bytes_Type() ) > 0; }
#endif
#if defined(PY_WIN32_DELAYLOAD_PYTHON_DLL)
# if defined(MS_WINDOWS)
# include
static HMODULE python_dll;
# define PYCXX_STANDARD_EXCEPTION( eclass, bclass ) \
static PyObject *ptr_Exc_##eclass = NULL;
# if PY_MAJOR_VERSION == 2
# include "CXX/Python2/cxx_standard_exceptions.hxx"
# else
# include "CXX/Python3/cxx_standard_exceptions.hxx"
# endif
# undef PYCXX_STANDARD_EXCEPTION
static PyTypeObject *ptr__CFunction_Type = NULL;
static PyTypeObject *ptr__Complex_Type = NULL;
static PyTypeObject *ptr__Dict_Type = NULL;
static PyTypeObject *ptr__Float_Type = NULL;
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
static PyTypeObject *ptr__Function_Type = NULL;
# endif
static PyTypeObject *ptr__Bool_Type = NULL;
static PyTypeObject *ptr__List_Type = NULL;
static PyTypeObject *ptr__Long_Type = NULL;
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
static PyTypeObject *ptr__Method_Type = NULL;
# endif
static PyTypeObject *ptr__Module_Type = NULL;
static PyTypeObject *ptr__Range_Type = NULL;
static PyTypeObject *ptr__Slice_Type = NULL;
static PyTypeObject *ptr__TraceBack_Type = NULL;
static PyTypeObject *ptr__Tuple_Type = NULL;
static PyTypeObject *ptr__Type_Type = NULL;
static PyTypeObject *ptr__Unicode_Type = NULL;
# if PY_MAJOR_VERSION == 2
static PyTypeObject *ptr__Int_Type = NULL;
static PyTypeObject *ptr__String_Type = NULL;
static PyTypeObject *ptr__CObject_Type = NULL;
# endif
# if PY_MAJOR_VERSION >= 3
static PyTypeObject *ptr__Bytes_Type = NULL;
# endif
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
# if PY_MAJOR_VERSION == 2 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11)
static int *ptr_Py_DebugFlag = NULL;
static int *ptr_Py_InteractiveFlag = NULL;
static int *ptr_Py_OptimizeFlag = NULL;
static int *ptr_Py_NoSiteFlag = NULL;
static int *ptr_Py_VerboseFlag = NULL;
# endif
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
static const char **ptr__Py_PackageContext = NULL;
# else
static char **ptr__Py_PackageContext = NULL;
# endif
# endif
# endif
# ifdef Py_REF_DEBUG
int *ptr_Py_RefTotal;
# endif
//--------------------------------------------------------------------------------
class GetAddressException
{
public:
GetAddressException( const char *_name )
: name( _name )
{}
virtual ~GetAddressException() {}
const char *name;
};
//--------------------------------------------------------------------------------
static PyObject *GetPyObjectPointer_As_PyObjectPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return *(PyObject **)addr;
}
static PyObject *GetPyObject_As_PyObjectPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return (PyObject *)addr;
}
static PyTypeObject *GetPyTypeObjectPointer_As_PyTypeObjectPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return *(PyTypeObject **)addr;
}
static PyTypeObject *GetPyTypeObject_As_PyTypeObjectPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return (PyTypeObject *)addr;
}
static int *GetInt_as_IntPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return (int *)addr;
}
static char **GetCharPointer_as_CharPointerPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return (char **)addr;
}
#if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
static char **GetConstCharPointer_as_ConstCharPointerPointer( const char *name )
{
FARPROC addr = GetProcAddress( python_dll, name );
if( addr == NULL )
throw GetAddressException( name );
return (const char **)addr;
}
#endif
# ifdef _DEBUG
static const char python_dll_name_format[] = "PYTHON%1.1d%1.1d_D.DLL";
# else
static const char python_dll_name_format[] = "PYTHON%1.1d%1.1d.DLL";
# endif
//--------------------------------------------------------------------------------
bool InitialisePythonIndirectInterface()
{
char python_dll_name[sizeof(python_dll_name_format)];
_snprintf( python_dll_name, sizeof(python_dll_name_format) / sizeof(char) - 1, python_dll_name_format, PY_MAJOR_VERSION, PY_MINOR_VERSION );
python_dll = LoadLibraryA( python_dll_name );
if( python_dll == NULL )
return false;
try
{
# ifdef Py_REF_DEBUG
ptr_Py_RefTotal = GetInt_as_IntPointer( "_Py_RefTotal" );
# endif
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
# if PY_MAJOR_VERSION == 2 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11)
ptr_Py_DebugFlag = GetInt_as_IntPointer( "Py_DebugFlag" );
ptr_Py_InteractiveFlag = GetInt_as_IntPointer( "Py_InteractiveFlag" );
ptr_Py_OptimizeFlag = GetInt_as_IntPointer( "Py_OptimizeFlag" );
ptr_Py_NoSiteFlag = GetInt_as_IntPointer( "Py_NoSiteFlag" );
ptr_Py_VerboseFlag = GetInt_as_IntPointer( "Py_VerboseFlag" );
# endif
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
ptr__Py_PackageContext = GetConstCharPointer_as_ConstCharPointerPointer( "_Py_PackageContext" );
# else
ptr__Py_PackageContext = GetCharPointer_as_CharPointerPointer( "_Py_PackageContext" );
# endif
# endif
# endif
# define PYCXX_STANDARD_EXCEPTION( eclass, bclass )
ptr_Exc_#eclass = GetPyTypeObject_As_PyTypeObjectPointer( "PyExc_" #eclass );
# if PY_MAJOR_VERSION == 2
# include "CXX/Python2/cxx_standard_exceptions.hxx"
# else
# include "CXX/Python3/cxx_standard_exceptions.hxx"
# endif
# undef PYCXX_STANDARD_EXCEPTION
ptr__PyNone = GetPyObject_As_PyObjectPointer( "_Py_NoneStruct" );
# if PY_MAJOR_VERSION == 2
ptr__PyFalse = GetPyObject_As_PyObjectPointer( "_Py_ZeroStruct" );
# else
ptr__PyFalse = GetPyObject_As_PyObjectPointer( "_Py_FalseStruct" );
# endif
ptr__PyTrue = GetPyObject_As_PyObjectPointer( "_Py_TrueStruct" );
ptr__CFunction_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyCFunction_Type" );
ptr__Complex_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyComplex_Type" );
ptr__Dict_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyDict_Type" );
ptr__Float_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFloat_Type" );
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
ptr__Function_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyFunction_Type" );
# endif
ptr__Bool_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyBool_Type" );
ptr__List_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyList_Type" );
ptr__Long_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyLong_Type" );
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
ptr__Method_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyMethod_Type" );
# endif
ptr__Module_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyModule_Type" );
ptr__Range_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyRange_Type" );
ptr__Slice_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PySlice_Type" );
ptr__TraceBack_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyTraceBack_Type" );
ptr__Tuple_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyTuple_Type" );
ptr__Type_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyType_Type" );
ptr__Unicode_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyUnicode_Type" );
# if PY_MAJOR_VERSION == 2
ptr__String_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyString_Type" );
ptr__Int_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyInt_Type" );
ptr__CObject_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyCObject_Type" );
# endif
# if PY_MAJOR_VERSION >= 3
ptr__Bytes_Type = GetPyTypeObject_As_PyTypeObjectPointer( "PyBytes_Type" );
# endif
}
catch( GetAddressException &e )
{
OutputDebugStringA( python_dll_name );
OutputDebugStringA( " does not contain symbol " );
OutputDebugStringA( e.name );
OutputDebugStringA( "\n" );
return false;
}
return true;
}
//
// Wrap variables as function calls
//
PyObject *_Exc_ArithmeticError() { return ptr__Exc_ArithmeticError; }
PyObject *_Exc_AssertionError() { return ptr__Exc_AssertionError; }
PyObject *_Exc_AttributeError() { return ptr__Exc_AttributeError; }
PyObject *_Exc_EnvironmentError() { return ptr__Exc_EnvironmentError; }
PyObject *_Exc_EOFError() { return ptr__Exc_EOFError; }
PyObject *_Exc_Exception() { return ptr__Exc_Exception; }
PyObject *_Exc_FloatingPointError() { return ptr__Exc_FloatingPointError; }
PyObject *_Exc_ImportError() { return ptr__Exc_ImportError; }
PyObject *_Exc_IndexError() { return ptr__Exc_IndexError; }
PyObject *_Exc_IOError() { return ptr__Exc_IOError; }
PyObject *_Exc_KeyboardInterrupt() { return ptr__Exc_KeyboardInterrupt; }
PyObject *_Exc_KeyError() { return ptr__Exc_KeyError; }
PyObject *_Exc_LookupError() { return ptr__Exc_LookupError; }
PyObject *_Exc_MemoryError() { return ptr__Exc_MemoryError; }
PyObject *_Exc_NameError() { return ptr__Exc_NameError; }
PyObject *_Exc_NotImplementedError() { return ptr__Exc_NotImplementedError; }
PyObject *_Exc_OSError() { return ptr__Exc_OSError; }
PyObject *_Exc_OverflowError() { return ptr__Exc_OverflowError; }
PyObject *_Exc_RuntimeError() { return ptr__Exc_RuntimeError; }
# if PY_MAJOR_VERSION == 2
PyObject *_Exc_StandardError() { return ptr__Exc_StandardError; }
# endif
PyObject *_Exc_SyntaxError() { return ptr__Exc_SyntaxError; }
PyObject *_Exc_SystemError() { return ptr__Exc_SystemError; }
PyObject *_Exc_SystemExit() { return ptr__Exc_SystemExit; }
PyObject *_Exc_TypeError() { return ptr__Exc_TypeError; }
PyObject *_Exc_ValueError() { return ptr__Exc_ValueError; }
# ifdef MS_WINDOWS
PyObject *_Exc_WindowsError() { return ptr__Exc_WindowsError; }
# endif
PyObject *_Exc_ZeroDivisionError() { return ptr__Exc_ZeroDivisionError; }
PyObject *_Exc_IndentationError() { return ptr__Exc_IndentationError; }
PyObject *_Exc_TabError() { return ptr__Exc_TabError; }
PyObject *_Exc_UnboundLocalError() { return ptr__Exc_UnboundLocalError; }
PyObject *_Exc_UnicodeError() { return ptr__Exc_UnicodeError; }
//
// wrap items in Object.h
//
PyObject *_None() { return ptr__PyNone; }
PyObject *_False() { return ptr__PyFalse; }
PyObject *_True() { return ptr__PyTrue; }
PyTypeObject *_CFunction_Type() { return ptr__CFunction_Type; }
PyTypeObject *_Complex_Type() { return ptr__Complex_Type; }
PyTypeObject *_Dict_Type() { return ptr__Dict_Type; }
PyTypeObject *_Float_Type() { return ptr__Float_Type; }
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
PyTypeObject *_Function_Type() { return ptr__Function_Type; }
# endif
PyTypeObject *_Bool_Type() { return ptr__Bool_Type; }
PyTypeObject *_List_Type() { return ptr__List_Type; }
PyTypeObject *_Long_Type() { return ptr__Long_Type; }
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
PyTypeObject *_Method_Type() { return ptr__Method_Type; }
# endif
PyTypeObject *_Module_Type() { return ptr__Module_Type; }
PyTypeObject *_Range_Type() { return ptr__Range_Type; }
PyTypeObject *_Slice_Type() { return ptr__Slice_Type; }
PyTypeObject *_TraceBack_Type() { return ptr__TraceBack_Type; }
PyTypeObject *_Tuple_Type() { return ptr__Tuple_Type; }
PyTypeObject *_Type_Type() { return ptr__Type_Type; }
PyTypeObject *_Unicode_Type() { return ptr__Unicode_Type; }
# if PY_MAJOR_VERSION == 2
PyTypeObject *_String_Type() { return ptr__String_Type; }
PyTypeObject *_Int_Type() { return ptr__Int_Type; }
PyTypeObject *_CObject_Type() { return ptr__CObject_Type; }
# endif
# if PY_MAJOR_VERSION >= 3
PyTypeObject *_Bytes_Type() { return ptr__Bytes_Type; }
# endif
//
// wrap the Python Flag variables
//
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
# if PY_MAJOR_VERSION == 2 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11)
int &_Py_DebugFlag() { return *ptr_Py_DebugFlag; }
int &_Py_InteractiveFlag() { return *ptr_Py_InteractiveFlag; }
int &_Py_OptimizeFlag() { return *ptr_Py_OptimizeFlag; }
int &_Py_NoSiteFlag() { return *ptr_Py_NoSiteFlag; }
int &_Py_VerboseFlag() { return *ptr_Py_VerboseFlag; }
# endif
# endif
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
const char *__Py_PackageContext() { return *ptr__Py_PackageContext; }
# else
char *__Py_PackageContext() { return *ptr__Py_PackageContext; }
# endif
# endif
# if 0
# define Py_INCREF(op) ( \
_Py_INC_REFTOTAL _Py_REF_DEBUG_COMMA \
((PyObject*)(op))->ob_refcnt++)
# define Py_DECREF(op) \
if (_Py_DEC_REFTOTAL _Py_REF_DEBUG_COMMA \
--((PyObject*)(op))->ob_refcnt != 0) \
_Py_CHECK_REFCNT(op) \
else \
_Py_Dealloc((PyObject *)(op))
# endif
void _XINCREF( PyObject *op )
{
// This function must match the contents of Py_XINCREF(op)
if( op == NULL )
return;
# ifdef Py_REF_DEBUG
(*ptr_Py_RefTotal)++;
# endif
(op)->ob_refcnt++;
}
void _XDECREF( PyObject *op )
{
// This function must match the contents of Py_XDECREF(op);
if( op == NULL )
return;
# ifdef Py_REF_DEBUG
(*ptr_Py_RefTotal)--;
# endif
if (--(op)->ob_refcnt == 0)
_Py_Dealloc((PyObject *)(op));
}
# else
# error "Can only delay load under Win32"
# endif
#else
//================================================================================
//
// Map onto Macros
//
//================================================================================
//
// Wrap variables as function calls
//
# define PYCXX_STANDARD_EXCEPTION( eclass, bclass ) \
PyObject *_Exc_##eclass() { return ::PyExc_##eclass; }
# if PY_MAJOR_VERSION == 2
# include "CXX/Python2/cxx_standard_exceptions.hxx"
# else
# include "CXX/Python3/cxx_standard_exceptions.hxx"
# endif
# undef PYCXX_STANDARD_EXCEPTION
//
// wrap items in Object.h
//
PyObject *_None() { return &::_Py_NoneStruct; }
PyObject *_False() { return Py_False; }
PyObject *_True() { return Py_True; }
PyTypeObject *_CFunction_Type() { return &PyCFunction_Type; }
PyTypeObject *_Complex_Type() { return &PyComplex_Type; }
PyTypeObject *_Dict_Type() { return &PyDict_Type; }
PyTypeObject *_Float_Type() { return &PyFloat_Type; }
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
PyTypeObject *_Function_Type() { return &PyFunction_Type; }
# endif
PyTypeObject *_Bool_Type() { return &PyBool_Type; }
PyTypeObject *_List_Type() { return &PyList_Type; }
PyTypeObject *_Long_Type() { return &PyLong_Type; }
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
PyTypeObject *_Method_Type() { return &PyMethod_Type; }
# endif
PyTypeObject *_Module_Type() { return &PyModule_Type; }
PyTypeObject *_Range_Type() { return &PyRange_Type; }
PyTypeObject *_Slice_Type() { return &PySlice_Type; }
PyTypeObject *_TraceBack_Type() { return &PyTraceBack_Type; }
PyTypeObject *_Tuple_Type() { return &PyTuple_Type; }
PyTypeObject *_Type_Type() { return &PyType_Type; }
PyTypeObject *_Unicode_Type() { return &PyUnicode_Type; }
# if PY_MAJOR_VERSION == 2
PyTypeObject *_String_Type() { return &PyString_Type; }
PyTypeObject *_Int_Type() { return &PyInt_Type; }
PyTypeObject *_CObject_Type() { return &PyCObject_Type; }
# endif
# if PY_MAJOR_VERSION >= 3
PyTypeObject *_Bytes_Type() { return &PyBytes_Type; }
# endif
//
// wrap flags
//
# if PY_MAJOR_VERSION == 2 || !defined( Py_LIMITED_API )
# if PY_MAJOR_VERSION == 2 || (PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11)
int &_Py_DebugFlag() { return Py_DebugFlag; }
int &_Py_InteractiveFlag() { return Py_InteractiveFlag; }
int &_Py_OptimizeFlag() { return Py_OptimizeFlag; }
int &_Py_NoSiteFlag() { return Py_NoSiteFlag; }
int &_Py_VerboseFlag() { return Py_VerboseFlag; }
# endif
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION <= 11
# if PY_MAJOR_VERSION == 3 && PY_MINOR_VERSION >= 7
const char *__Py_PackageContext() { return _Py_PackageContext; }
# else
char *__Py_PackageContext() { return _Py_PackageContext; }
# endif
# endif
# endif
//
// Needed to keep the abstactions for delayload interface
//
void _XINCREF( PyObject *op )
{
Py_XINCREF( op );
}
void _XDECREF( PyObject *op )
{
Py_XDECREF( op );
}
#endif
}
pysvn-1.9.22/Import/pycxx-7.1.9/Src/Python2/cxxextensions.c 000644 000765 000024 00000004370 13662723705 023544 0 ustar 00barry staff 000000 000000 /*----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//---------------------------------------------------------------------------*/
#include "CXX/WrapPython.h"
#ifdef __cplusplus
extern "C"
{
#endif
PyObject py_object_initializer = {PyObject_HEAD_INIT(0)};
#ifdef __cplusplus
}
#endif
pysvn-1.9.22/Import/pycxx-7.1.9/Src/Python2/cxxsupport.cxx 000644 000765 000024 00000012115 13662723705 023435 0 ustar 00barry staff 000000 000000 //-----------------------------------------------------------------------------
//
// Copyright (c) 1998 - 2007, The Regents of the University of California
// Produced at the Lawrence Livermore National Laboratory
// All rights reserved.
//
// This file is part of PyCXX. For details,see http://cxx.sourceforge.net/. The
// full copyright notice is contained in the file COPYRIGHT located at the root
// of the PyCXX distribution.
//
// Redistribution and use in source and binary forms, with or without
// modification, are permitted provided that the following conditions are met:
//
// - Redistributions of source code must retain the above copyright notice,
// this list of conditions and the disclaimer below.
// - Redistributions in binary form must reproduce the above copyright notice,
// this list of conditions and the disclaimer (as noted below) in the
// documentation and/or materials provided with the distribution.
// - Neither the name of the UC/LLNL nor the names of its contributors may be
// used to endorse or promote products derived from this software without
// specific prior written permission.
//
// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
// AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
// IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
// ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OF THE UNIVERSITY OF
// CALIFORNIA, THE U.S. DEPARTMENT OF ENERGY OR CONTRIBUTORS BE LIABLE FOR
// ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
// DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
// SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
// CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
// LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
// OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH
// DAMAGE.
//
//-----------------------------------------------------------------------------
#include "CXX/Objects.hxx"
namespace Py {
Py_UNICODE unicode_null_string[1] = { 0 };
Type Object::type () const
{
return Type (PyObject_Type (p), true);
}
String Object::str () const
{
return String (PyObject_Str (p), true);
}
String Object::repr () const
{
return String (PyObject_Repr (p), true);
}
std::string Object::as_string() const
{
return static_cast(str());
}
List Object::dir () const
{
return List (PyObject_Dir (p), true);
}
bool Object::isType (const Type& t) const
{
return type ().ptr() == t.ptr();
}
Char::operator String() const
{
return String(ptr());
}
// TMM: non-member operaters for iterators - see above
// I've also made a bug fix in respect to the cxx code
// (dereffed the left.seq and right.seq comparison)
bool operator==(const Sequence::iterator& left, const Sequence::iterator& right)
{
return left.eql( right );
}
bool operator!=(const Sequence::iterator& left, const Sequence::iterator& right)
{
return left.neq( right );
}
bool operator< (const Sequence::iterator& left, const Sequence::iterator& right)
{
return left.lss( right );
}
bool operator> (const Sequence::iterator& left, const Sequence::iterator& right)
{
return left.gtr( right );
}
bool operator<=(const Sequence::iterator& left, const Sequence::iterator& right)
{
return left.leq( right );
}
bool operator>=(const Sequence::iterator& left, const Sequence::iterator& right)
{
return left.geq( right );
}
// now for const_iterator
bool operator==(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
{
return left.eql( right );
}
bool operator!=(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
{
return left.neq( right );
}
bool operator< (const Sequence::const_iterator& left, const Sequence::const_iterator& right)
{
return left.lss( right );
}
bool operator> (const Sequence::const_iterator& left, const Sequence::const_iterator& right)
{
return left.gtr( right );
}
bool operator<=(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
{
return left.leq( right );
}
bool operator>=(const Sequence::const_iterator& left, const Sequence::const_iterator& right)
{
return left.geq( right );
}
// For mappings:
bool operator==(const Mapping::iterator& left, const Mapping::iterator& right)
{
return left.eql( right );
}
bool operator!=(const Mapping::iterator& left, const Mapping::iterator& right)
{
return left.neq( right );
}
// now for const_iterator
bool operator==(const Mapping::const_iterator& left, const Mapping::const_iterator& right)
{
return left.eql( right );
}
bool operator!=(const Mapping::const_iterator& left, const Mapping::const_iterator& right)
{
return left.neq( right );
}
// TMM: 31May'01 - Added the #ifndef so I can exclude iostreams.
#ifndef CXX_NO_IOSTREAMS
// output
std::ostream& operator<< (std::ostream& os, const Object& ob)
{
return (os << static_cast(ob.str()));
}
#endif
} // Py
pysvn-1.9.22/Import/pycxx-7.1.9/Src/Python2/cxx_exceptions.cxx 000644 000765 000024 00000003231 12733320460 024225 0 ustar 00barry staff 000000 000000 //
// cxx_exceptions.cxx
//
#include
#include
#include