Changeset 361


Ignore:
Timestamp:
Nov 21, 2008, 12:08:17 PM (11 years ago)
Author:
cito
Message:

Some adaptions for Py 2.6 and Windows.

Location:
trunk
Files:
4 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/future.txt

    r360 r361  
    2626  and should get its own unit test module.
    2727- The fetch method should use real cursors.
    28 - What shall we do with the "tutorial" directory?
    29   - it's rather a tutorial for Postgres/SQL than for PyGreSQL
    30   - it' using only the query method from the classic pg module,
    31     no other PyGreSQL functionality
    32   - it's rather a demo than a tutorial
     28- What shall we do with the "tutorial" directory
     29  (it's rather a tutorial for Postgres/SQL than for PyGreSQL,
     30  it' using only the query method from the classic pg module and
     31  no other PyGreSQL functionality, it's rather a demo than a tutorial)?
    3332
    3433
  • trunk/docs/install.txt

    r351 r361  
    5757--------------------------------------
    5858
    59 You can build and install PyGreSQL using Distutils.
    60 
    61 On a Microsoft Windows system, you should have the Microsoft Visual C++ compiler
    62 and the Microsoft .NET Framework SDK installed and on your search path.
    63 If you want to use the free Microsoft Visual C++ Toolkit 2003 compiler,
    64 you need to `patch distutils <http://www.vrplumber.com/programming/mstoolkit/>`_.
    65 Alternatively, you can use `MinGW <http://www.mingw.org>`_.
     59You can build and install PyGreSQL using
     60`Distutils <http://docs.python.org/install/>`_.
    6661
    6762Download and unpack the PyGreSQL source tarball if you haven't already done so.
     
    7267    python setup.py install
    7368
    74 Note that the official Python 2.4 distribution for Microsoft Windows is now
    75 using msvcr71 instead of msvcrt as its common runtime library. So, if you are
    76 using MinGW to build PyGreSQL for Python 2.4 on a Windows system, you should
    77 edit the file ``%MinGWpath%/lib/gcc/%MinGWversion%/specs`` and change the entry
    78 that reads ``-lmsvcrt`` to ``-lmsvcr71``. Then use the following command to
    79 build and install PyGreSQL::
     69If you are using `MinGW <http://www.mingw.org>`_ to build PyGreSQL on a
     70Microsoft Windows, please note that Python newer version 2.3 is using msvcr71
     71instead of msvcrt as its common runtime library. You can allow for that by
     72editing the file ``%MinGWpath%/lib/gcc/%MinGWversion%/specs`` and changing
     73the entry that reads ``-lmsvcrt`` to ``-lmsvcr71``. You may also need to copy
     74``libpq.lib`` to ``libpq.a`` in the PostgreSQL ``lib`` directory. Then use
     75the following command to build and install PyGreSQL::
    8076
    8177    python setup.py build -c mingw32 install
  • trunk/module/pgmodule.c

    r345 r361  
    11/*
    2  * $Id: pgmodule.c,v 1.82 2008-11-01 18:15:53 cito Exp $
     2 * $Id: pgmodule.c,v 1.83 2008-11-21 17:08:17 cito Exp $
    33 * PyGres, version 2.2 A Python interface for PostgreSQL database. Written by
    44 * D'Arcy J.M. Cain, (darcy@druid.net).  Based heavily on code written by
     
    4949static const char *PyPgVersion = "4.0";
    5050
     51#if PY_VERSION_HEX < 0x02050000 && !defined(PY_SSIZE_T_MIN)
     52typedef int Py_ssize_t;
     53#define PY_SSIZE_T_MAX INT_MAX
     54#define PY_SSIZE_T_MIN INT_MIN
     55#endif
     56
    5157/* taken from fileobject.c */
    5258#define BUF(v) PyString_AS_STRING((PyStringObject *)(v))
     
    5460/* default values */
    5561#define MODULE_NAME                     "pgsql"
    56 #define ARRAYSIZE                       1
     62#define PG_ARRAYSIZE                    1
    5763
    5864/* flags for object validity checks */
     
    8389#ifndef NO_DIRECT
    8490#define DIRECT_ACCESS   1               /* enables direct access functions */
    85 #endif /* NO_DIRECT */
     91#endif
    8692
    8793#ifndef NO_LARGE
    8894#define LARGE_OBJECTS   1               /* enables large objects support */
    89 #endif /* NO_LARGE */
     95#endif
    9096
    9197#ifndef NO_DEF_VAR
    9298#define DEFAULT_VARS    1               /* enables default variables use */
    93 #endif /* NO_DEF_VAR */
     99#endif
    94100
    95101/* In 7.4 PQfreeNotify was deprecated and PQfreemem is used instead.
     
    450456        npgobj->last_result = NULL;
    451457        npgobj->valid = 1;
    452         npgobj->arraysize = ARRAYSIZE;
     458        npgobj->arraysize = PG_ARRAYSIZE;
    453459
    454460        return npgobj;
     
    24602466                                *sublist,
    24612467                                *item;
    2462         PyObject        *(*getitem) (PyObject *, int);
    2463         PyObject        *(*getsubitem) (PyObject *, int);
     2468        PyObject        *(*getitem) (PyObject *, Py_ssize_t);
     2469        PyObject        *(*getsubitem) (PyObject *, Py_ssize_t);
    24642470        int                     i,
    24652471                                j,
  • trunk/module/setup.py

    r360 r361  
    11#!/usr/bin/env python
    2 # $Id: setup.py,v 1.26 2008-11-21 13:55:22 cito Exp $
     2# $Id: setup.py,v 1.27 2008-11-21 17:08:17 cito Exp $
    33
    44"""Setup script for PyGreSQL version 4.0
     
    1010* tweaked 2000/05 Jeremy Hylton <jeremy@cnri.reston.va.us>
    1111* win32 support 2001/01 by Gerhard Haering <gerhard@bigfoot.de>
    12 * tweaked 2006/02 Christoph Zwerschke <cito@online.de>
     12* tweaked 2006/02 and 2008/11 by Christoph Zwerschke <cito@online.de>
    1313
    1414Prerequisites to be installed:
     
    2525python setup.py install # to install it
    2626
    27 For Win32, you should have the Microsoft Visual C++ compiler and
    28 the Microsoft .NET Framework SDK installed and on your search path.
    29 If you want to use the free Microsoft Visual C++ Toolkit 2003 compiler,
    30 you need to patch distutils (www.vrplumber.com/programming/mstoolkit/).
    31 Alternatively, you can use MinGW (www.mingw.org) for building on Win32:
     27You should use MinGW (www.mingw.org) for building on Win32:
    3228python setup.py build -c mingw32 install # use MinGW
    33 Note that the official Python distribution is now using msvcr71 instead
    34 of msvcrt as its common runtime library. So, if you are using MinGW to build
    35 PyGreSQL, you should edit the file "%MinGWpath%/lib/gcc/%MinGWversion%/specs"
     29Note that Python newer than version 2.3 is using msvcr71 instead of msvcrt
     30as its common runtime library. So, if you are using MinGW to build PyGreSQL,
     31you should edit the file "%MinGWpath%/lib/gcc/%MinGWversion%/specs"
    3632and change the entry that reads -lmsvcrt to -lmsvcr71.
    3733
    38 See www.python.org/doc/current/inst/ for more information
    39 on using distutils to install Python programs.
     34See docs.python.org/doc/install/ for more information on
     35using distutils to install Python programs.
    4036
    4137"""
     
    6864    The directory will contain a copy of the PostgreSQL server header files,
    6965    where all features which are not necessary for PyGreSQL are disabled.
     66
    7067    """
    7168    os.mkdir('include')
     
    7572        d = open(os.path.join(pg_include_dir_server, f)).read()
    7673        if f == 'pg_config.h':
    77             d += '\n'
    78             d += '#undef ENABLE_NLS\n'
    79             d += '#undef USE_REPL_SNPRINTF\n'
    80             d += '#undef USE_SSL\n'
     74            d += '\n'.join(('',
     75                '#undef ENABLE_NLS',
     76                '#undef USE_REPL_SNPRINTF',
     77                '#undef USE_SSL',
     78                '#undef USE_ZLIB',
     79                '#undef HAVE_STDINT_H',
     80                '#undef HAVE_SYS_TIME_H',
     81                '#undef HAVE_UNISTD_H',
     82                '#define _CRT_SECURE_NO_WARNINGS 1',
     83                '#define _USE_32BIT_TIME_T 1',
     84                ''))
    8185        open(os.path.join('include', f), 'w').write(d)
    8286
     
    116120    author_email="darcy@PyGreSQL.org",
    117121    url="http://www.pygresql.org",
     122    download_url = "ftp://ftp.pygresql.org/pub/distrib/",
     123    platforms = ["any"],
    118124    license="Python",
    119125    py_modules=['pg', 'pgdb'],
     
    133139        "Programming Language :: Python",
    134140        "Topic :: Database",
     141        "Topic :: Database :: Front-Ends",
    135142        "Topic :: Software Development :: Libraries :: Python Modules"
    136143    ]
Note: See TracChangeset for help on using the changeset viewer.