Commit fdbb6c2a authored by Josué Ortega's avatar Josué Ortega

Import pysvn_1.9.4.orig.tar.gz

parent a1f29e47
@echo off
set PY_MAJ=2
if not "%1" == "" set PY_MAJ=%1
set PY_MIN=7
if not "%2" == "" set PY_MIN=%2
if not "%3" == "" set BUILD_TYPE=%3
if not "%4" == "" set SVN_VER_MAJ_MIN=%4
if "%SVN_VER_MAJ_MIN%" == "" set /p SVN_VER_MAJ_MIN="Build Version (1.8): "
if "%SVN_VER_MAJ_MIN%" == "" set SVN_VER_MAJ_MIN=1.8
set SVN_VER_MAJ_DASH_MIN=%SVN_VER_MAJ_MIN:.=-%
rem Save CWD
pushd .
set VC_VER=9.0
if exist ..\..\ReleaseEngineering\win32-vc-%VC_VER%\software-versions-%SVN_VER_MAJ_MIN%.cmd (
echo Setting up compiler VC %VC_VER%
pushd ..\..\ReleaseEngineering\win32-vc-%VC_VER%
call software-versions-%SVN_VER_MAJ_MIN%.cmd off
popd
) else (
echo No compiler setup found
pause
)
set PYCXX=%BUILDER_TOP_DIR%\Import\pycxx-%PYCXX_VER%
set PY=c:\python%PY_MAJ%%PY_MIN%.win32
if not exist %PY%\python.exe set PY=c:\python%PY_MAJ%%PY_MIN%
set PYTHONPATH=%BUILDER_TOP_DIR%\Source
set PYTHON=%PY%\python.exe
rem Need python and SVN on the path
PATH %PY%;%SVN_BIN%;%PATH%
rem prove the python version selected
python -c "import sys;print( 'Info: Python Version %%s' %% sys.version )"
echo SVN Version:
svn --version --quiet
rem restore original CWD
popd
rem empty
......@@ -5,10 +5,12 @@ if [ ! -z "$1" ]
then
PREF_VER=$1.$2
else
PREF_VER=2.7
PREF_VER=3.5
fi
for PY_VER in ${PREF_VER} 2.7 2.6
export PYCXX_VER=7.0.1
for PY_VER in ${PREF_VER} 3.5 3.4 2.7
do
# used in pick python to use in Builder driver makefile
export PYTHON=$( which python${PY_VER} )
......
#!/bin/bash
#!/bin/bash -x
#
# make-devel-rpm-build.sh
#
......@@ -10,14 +10,17 @@ rm -rf /tmp/pysvn-${V}
svn export --quiet .. /tmp/pysvn-${V}
BUILD=$( svnversion .. )
cat <<EOF >/tmp/pysvn-workbench-${V}/Builder/version.info
cat <<EOF >/tmp/pysvn-${V}/Builder/version.info
MAJOR=${MAJOR}
MINOR=${MINOR}
PATCH=${PATCH}
BUILD=${BUILD}
EOF
echo Info: Creating source kit...
tar czf ~/rpmbuild/SOURCES/pysvn-${V}.tar.gz -C /tmp pysvn-${V}
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 ~/rpmbuild/SPECS
cd /tmp/rpmbuild/SPECS
rpmbuild -ba pysvn.spec
MAJOR=1
MINOR=8
PATCH=0
MINOR=9
PATCH=4
BUILD=0
This diff is collapsed.
//
// ====================================================================
// Copyright (c) 2006 Barry A Scott. All rights reserved.
// Copyright (c) 2006-2016 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.
//
// ====================================================================
//
all_versions = new Array( 1001000, 1002000, 1003000, 1004000, 1005000 )
all_versions = new Array( 1001000, 1002000, 1003000, 1004000, 1005000, 1006000, 1007000, 1008000, 1009000 )
current_version = 1005000;
current_version = 1009000;
change_style = "hilite";
function changeDisplay( version )
......
This diff is collapsed.
setlocal
call setup-msvc90
c:\python27.win32\python setup_makefile.py win32 win32.mak
nmake -f win32.mak clean all 2>&1 | c:\unxutils\tee tmp-python27-build.log
nmake -f win32.mak test 2>&1 | c:\unxutils\tee tmp-python27-test.log
c:\python32.win32\python setup_makefile.py win32 win32.mak
nmake -f win32.mak clean all 2>&1 | c:\unxutils\tee tmp-python32-build.log
nmake -f win32.mak test 2>&1 | c:\unxutils\tee tmp-python32-test.log
c:\python33.win32\python setup_makefile.py win32 win32.mak
nmake -f win32.mak clean all 2>&1 | c:\unxutils\tee tmp-python33-build.log
nmake -f win32.mak test 2>&1 | c:\unxutils\tee tmp-python33-test.log
c:\python34.win32\python setup_makefile.py win32 win32.mak
nmake -f win32.mak clean all 2>&1 | c:\unxutils\tee tmp-python34-build.log
nmake -f win32.mak test 2>&1 | c:\unxutils\tee tmp-python34-test.log
endlocal
......@@ -125,7 +125,7 @@ namespace Py
~ExtensionClassMethodsTable()
{
delete m_methods_table;
delete[] m_methods_table;
}
// check that all methods added are unique
......@@ -220,7 +220,7 @@ namespace Py
#else
const char *default_name = "unknown";
#endif
p = new PythonType( sizeof( T ), 0, default_name );
p = new PythonType( sizeof( PythonClassInstance ), 0, default_name );
p->set_tp_new( extension_object_new );
p->set_tp_init( extension_object_init );
p->set_tp_dealloc( extension_object_deallocator );
......
......@@ -49,6 +49,8 @@
#include <iterator>
#include <utility>
#include <typeinfo>
#include <algorithm>
namespace Py
{
......@@ -101,19 +103,20 @@ namespace Py
//
/*
explicit MyType (PyObject *pyob): Object(pyob) {
validate();
}
validate();
}
MyType(const Object& other): Object(other.ptr()) {
validate();
}
validate();
}
*/
// Alernate version for the constructor to allow for construction from owned pointers:
/*
explicit MyType (PyObject *pyob): Object(pyob) {
validate();
}
explicit MyType (PyObject *pyob)
: Object(pyob) {
validate();
}
*/
// You may wish to add other constructors; see the classes below for examples.
......@@ -123,14 +126,14 @@ namespace Py
// (4) Each class needs at least these two assignment operators:
/*
MyType& operator= (const Object& rhs) {
return (*this = *rhs);
}
return (*this = *rhs);
}
Mytype& operator= (PyObject* rhsp) {
if(ptr() == rhsp) return *this;
set(rhsp);
return *this;
}
if(ptr() == rhsp) return *this;
set(rhsp);
return *this;
}
*/
// Note on accepts: constructors call the base class
// version of a virtual when calling the base class constructor,
......@@ -174,7 +177,8 @@ namespace Py
public:
// Constructor acquires new ownership of pointer unless explicitly told not to.
explicit Object (PyObject* pyob=Py::_None(), bool owned = false): p (pyob)
explicit Object (PyObject* pyob=Py::_None(), bool owned = false)
: p(pyob)
{
if(!owned)
{
......@@ -184,7 +188,8 @@ namespace Py
}
// Copy constructor acquires new ownership of pointer
Object (const Object& ob): p(ob.p)
Object (const Object& ob)
: p(ob.p)
{
Py::_XINCREF (p);
validate();
......@@ -226,9 +231,10 @@ namespace Py
{
// not allowed to commit suicide, however
if(reference_count() == 1)
throw RuntimeError("Object::decrement_reference_count error.");
throw RuntimeError("Object::decrement_reference_count error.");
Py::_XDECREF(p);
}
// Would like to call this pointer() but messes up STL in SeqBase<T>
PyObject* ptr () const
{
......@@ -371,13 +377,13 @@ namespace Py
void setAttr (const std::string& s, const Object& value)
{
if(PyObject_SetAttrString (p, const_cast<char*>(s.c_str()), *value) == -1)
throw AttributeError ("getAttr failed.");
throw AttributeError ("setAttr failed.");
}
void delAttr (const std::string& s)
{
if(PyObject_DelAttrString (p, const_cast<char*>(s.c_str())) == -1)
throw AttributeError ("delAttr failed.");
throw AttributeError ("delAttr failed.");
}
// PyObject_SetItem is too weird to be using from C++
......@@ -385,9 +391,9 @@ namespace Py
void delItem (const Object& key)
{
//if(PyObject_DelItem(p, *key) == -1)
// failed to link on Windows?
throw KeyError("delItem failed.");
if(PyObject_DelItem(p, *key) == -1)
// failed to link on Windows?
throw KeyError("delItem failed.");
}
// Equality and comparison use PyObject_RichCompareBool
......@@ -3213,18 +3219,35 @@ namespace Py
// Call
Object apply(const Tuple& args) const
{
return asObject(PyObject_CallObject(ptr(), args.ptr()));
PyObject *result = PyObject_CallObject( ptr(), args.ptr() );
if( result == NULL )
{
throw Exception();
}
return asObject( result );
}
// Call with keywords
Object apply(const Tuple& args, const Dict& kw) const
{
return asObject( PyEval_CallObjectWithKeywords( ptr(), args.ptr(), kw.ptr() ) );
PyObject *result = PyEval_CallObjectWithKeywords( ptr(), args.ptr(), kw.ptr() );
if( result == NULL )
{
throw Exception();
}
return asObject( result );
}
Object apply(PyObject* pargs = 0) const
{
return apply (Tuple(pargs));
if( pargs == 0 )
{
return apply( Tuple() );
}
else
{
return apply( Tuple( pargs ) );
}
}
};
......
......@@ -124,7 +124,7 @@ namespace Py
~ExtensionClassMethodsTable()
{
delete m_methods_table;
delete[] m_methods_table;
}
// check that all methods added are unique
......@@ -219,7 +219,7 @@ namespace Py
#else
const char *default_name = "unknown";
#endif
p = new PythonType( sizeof( T ), 0, default_name );
p = new PythonType( sizeof( PythonClassInstance ), 0, default_name );
p->set_tp_new( extension_object_new );
p->set_tp_init( extension_object_init );
p->set_tp_dealloc( extension_object_deallocator );
......
......@@ -50,6 +50,7 @@
#include <iterator>
#include <utility>
#include <typeinfo>
#include <algorithm>
namespace Py
{
......@@ -221,7 +222,9 @@ namespace Py
{
// not allowed to commit suicide, however
if( reference_count() == 1 )
throw RuntimeError( "Object::decrement_reference_count error." );
{
throw RuntimeError( "Object::decrement_reference_count error." );
}
Py::_XDECREF( p );
}
......@@ -378,13 +381,17 @@ namespace Py
void setAttr( const std::string &s, const Object &value )
{
if( PyObject_SetAttrString( p, const_cast<char*>( s.c_str() ), *value ) == -1 )
throw AttributeError( "getAttr failed." );
{
throw AttributeError( "setAttr failed." );
}
}
void delAttr( const std::string &s )
{
if( PyObject_DelAttrString( p, const_cast<char*>( s.c_str() ) ) == -1 )
{
throw AttributeError( "delAttr failed." );
}
}
// PyObject_SetItem is too weird to be using from C++
......@@ -392,9 +399,11 @@ namespace Py
void delItem( const Object &key )
{
//if( PyObject_DelItem( p, *key ) == -1 )
// failed to link on Windows?
throw KeyError( "delItem failed." );
if( PyObject_DelItem( p, *key ) == -1 )
{
// failed to link on Windows?
throw KeyError( "delItem failed." );
}
}
// Equality and comparison use PyObject_Compare
......@@ -1408,14 +1417,18 @@ namespace Py
void verify_length( size_type required_size ) const
{
if( size() != required_size )
{
throw IndexError( "Unexpected SeqBase<T> length." );
}
}
void verify_length( size_type min_size, size_type max_size ) const
{
size_type n = size();
if( n < min_size || n > max_size )
{
throw IndexError( "Unexpected SeqBase<T> length." );
}
}
class iterator
......@@ -1520,8 +1533,9 @@ namespace Py
int operator-( const iterator &other ) const
{
if( seq->ptr() != other.seq->ptr() )
{
throw RuntimeError( "SeqBase<T>::iterator comparison error" );
}
return count - other.count;
}
......@@ -1672,7 +1686,9 @@ namespace Py
int operator-( const const_iterator &other ) const
{
if( *seq != *other.seq )
{
throw RuntimeError( "SeqBase<T>::const_iterator::- error" );
}
return count - other.count;
}
......@@ -3122,7 +3138,9 @@ namespace Py
Callable &operator=( PyObject *rhsp )
{
if( ptr() != rhsp )
{
set( rhsp );
}
return *this;
}
......@@ -3135,18 +3153,35 @@ namespace Py
// Call
Object apply( const Tuple &args ) const
{
return asObject( PyObject_CallObject( ptr(), args.ptr() ) );
PyObject *result = PyObject_CallObject( ptr(), args.ptr() );
if( result == NULL )
{
throw Exception();
}
return asObject( result );
}
// Call with keywords
Object apply( const Tuple &args, const Dict &kw ) const
{
return asObject( PyEval_CallObjectWithKeywords( ptr(), args.ptr(), kw.ptr() ) );
PyObject *result = PyEval_CallObjectWithKeywords( ptr(), args.ptr(), kw.ptr() );
if( result == NULL )
{
throw Exception();
}
return asObject( result );
}
Object apply( PyObject *pargs = 0 ) const
{
return apply( Tuple( pargs ) );
if( pargs == 0 )
{
return apply( Tuple() );
}
else
{
return apply( Tuple( pargs ) );
}
}
};
......
......@@ -40,7 +40,7 @@
#define PYCXX_VERSION_MAJOR 6
#define PYCXX_VERSION_MINOR 2
#define PYCXX_VERSION_PATCH 6
#define PYCXX_VERSION_PATCH 8
#define PYCXX_MAKEVERSION( major, minor, patch ) ((major<<16)|(minor<<8)|(patch))
#define PYCXX_VERSION PYCXX_MAKEVERSION( PYCXX_VERSION_MAJOR, PYCXX_VERSION_MINOR, PYCXX_VERSION_PATCH )
#endif
......@@ -228,10 +228,12 @@ test_List_iterators (const Py::List& x, Py::List& y)
int caught_it = 0;
try
{
std::cout << "About to raise exception int(\"Howdy\")" << std::endl;
o2 = o1;
}
catch (Py::Exception& e)
catch (Py::Exception &e)
{
std::cout << "Catch o.k." << std::endl;
caught_it = 1;
e.clear();
}
......@@ -589,6 +591,20 @@ private:
debug_check_ref_queue();
std::cout << "Example Test starting" << std::endl;
try
{
// cannot create from NULL
Py::Object obj( NULL );
std::cout << "FAILED Py::Object( NULL )" << std::endl;
}
catch (Py::TypeError& e)
{
std::cout << "Correctly caught " << Py::type(e) << std::endl;
std::cout << " Py::Exception value: " << Py::value(e) << std::endl;
std::cout << " Py::Exception traceback: " << Py::trace(e) << std::endl;
e.clear();
}
try
{
PyObject *p = NULL;
......
......@@ -283,7 +283,7 @@ private:
#define EXPORT_SYMBOL
#endif
#if defined( PY3 )
#if PY_MAJOR_VERSION == 3
static simple_module *simple;
extern "C" EXPORT_SYMBOL PyObject *PyInit_simple()
......
......@@ -139,7 +139,7 @@ void test_boolean()
test_assert( "boolean true pybool var ", pb1 ? true : false, true );
b1 = pb1;
test_assert( "boolean true bool = pybool", pb1 ? true : false, true );
test_assert( "boolean true bool = pybool", b1, true );
pb2 = pb1;
test_assert( "boolean true pybool = pybool", pb2 ? true : false, true );
......@@ -157,7 +157,7 @@ void test_boolean()
test_assert( "boolean false pybool var ", pb1 ? true : false, false );
b1 = pb1;
test_assert( "boolean false bool = pybool", pb1 ? true : false, false );
test_assert( "boolean false bool = pybool", b1, false );
pb2 = pb1;
test_assert( "boolean false pybool = pybool", pb2 ? true : false, false );
......
......@@ -17,6 +17,11 @@
#include <assert.h>
// useful to set a break point on when debugging
void bpt()
{
}
class new_style_class: public Py::PythonClass< new_style_class >
{
public:
......@@ -52,6 +57,8 @@ public:
PYCXX_ADD_NOARGS_METHOD( func_noargs_raise_exception, new_style_class_func_noargs_raise_exception, "docs for func_noargs_raise_exception" );
PYCXX_ADD_VARARGS_METHOD( func_varargs_call_member, new_style_class_call_member, "docs for func_varargs_call_member" );
// Call to make the type ready for use
behaviors().readyType();
}
......@@ -71,6 +78,28 @@ public:
}