Changeset 259 for trunk/docs


Ignore:
Timestamp:
Feb 17, 2006, 3:51:45 PM (14 years ago)
Author:
cito
Message:

Updated installation instructions.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/docs/install.txt

    r213 r259  
    33=====================
    44
    5 .. note::
    6   *This documentation is pretty outdated and needs updates and additions*
     5.. sectnum::
     6.. contents:: Contents
    77
    8 Installation
    9 ============
    10 
    11 For a Linux x86 system that uses RPMs, you can pick up an RPM at
    12   ftp://ftp.druid.net/pub/distrib/pygresql.i386.rpm
    13 
    14 If you are using the DB-API 2.0 module you may consider installing mxDateTime.
    15 Otherwise, the Python standard lib datetime module is used.
    16 
    17 mxDateTime is avaliable at
    18   http://www.egenix.com/files/python/mxDateTime.html
    19 
    20 Also, check out setup.py for an alternate method of installing the package.
    21 
    22 You have two options.  You can compile PyGreSQL as a stand-alone module
    23 or you can build it into the Python interpreter.
    248
    259General
    2610=======
    2711
    28 * You must first have installed Python and PostgreSQL on your system.
    29   The header files and developer's libraries for both Python and PostgreSQL
    30   must be installed on your system before you can build PyGreSQL.  If you
    31   built both Python and PostgreSQL from source, you should be fine.  If your
    32   system uses some package mechanism (such as RPMs or NetBSD packages), then
    33   you probably need to install packages such as Python-devel in addition to
    34   the Python package.
     12You must first have installed Python and PostgreSQL on your system.
     13If you want to access remote database only, you don't need to install
     14the full PostgreSQL server, but only the C interface (libpq).
    3515
    36 * PyGreSQL is implemented as three parts, a C module labeled _pg and two
    37   Python wrappers called pg.py and pgdb.py.  This changed between 2.1 and
    38   2.2 and again in 3.0.  These changes should not affect any existing
    39   programs but the installation is slightly different.
     16If you are using the DB-API 2.0 module you may consider installing
     17`mxDateTime <http://www.egenix.com/files/python/mxDateTime.html>`_.
     18Otherwise, the Python standard lib datetime module is used.
    4019
    41 * Download and unpack the PyGreSQL tarball if you haven't already done so.
     20PyGreSQL will be installed as three modules, a dynamic module called
     21_pg.pyd, and two pure Python wrapper modules called pg.py and pgdb.py.
     22All three files will be installed directly into the Python site-packages
     23directory. To uninstall PyGreSQL, simply remove these three files again.
     24
     25
     26Installing from a Binary Distribution
     27=====================================
     28
     29This is the easiest way to install PyGreSQL.
     30
     31You can currently download PyGreSQL as Linux RPM, NetBSD package and Windows
     32installer. Make sure the required Python version of the binary package matches
     33the Python version you have installed.
     34
     35Install the package as usual on your system.
     36
     37
     38Installing from Source
     39======================
     40
     41If you want to install PyGreSQL from Source, or there is no binary
     42package available for your platform, follow these instructions.
     43
     44Make sure the Python header files and PostgreSQL client and server header
     45files are installed. These come usually with the "devel" packages on Unix
     46systems and the installer executables on Windows systems.
     47
     48If you are using a precompiled PostgreSQL, you will also need the pg_config
     49tool. This is usually also part of the "devel" package on Unix, and will be
     50installed as part of the database server feature on Windows systems.
     51
     52Building and installing with Distutils
     53--------------------------------------
     54
     55You can build and install PyGreSQL using Distutils.
     56
     57On a Windows system, you should have the Microsoft Visual C++ compiler and
     58the Microsoft .NET Framework SDK installed and on your search path.
     59If you want to use the free Microsoft Visual C++ Toolkit 2003 compiler,
     60you need to `patch distutils <http://www.vrplumber.com/programming/mstoolkit/>`_.
     61Alternatively, you can use `MinGW <http://www.mingw.org>`_.
     62
     63Download and unpack the PyGreSQL source tarball if you haven't already done so.
     64
     65Type the following commands to build and install PyGreSQL::
     66
     67    python setup.py build
     68    python setup.py install
     69
     70If you are using MinGW on a Windows system, you should edit the file
     71"%MinGWpath%/lib/gcc/%MinGWversion%/specs" and change the entry
     72that reads ``-lmsvcrt`` to ``-lmsvcr71``. Then use the following command
     73to build and install PyGreSQL::
     74
     75    python setup.py build -c mingw32 install
     76
     77Now you should be ready to use PyGreSQL.
     78
     79Compiling Manually
     80------------------
     81
     82The source file for compiling the dynamic module is called pgmodule.c.
     83You have two options. You can compile PyGreSQL as a stand-alone module
     84or you can build it into the Python interpreter.
    4285
    4386Stand-Alone
    44 ===========
     87-----------
    4588
    4689* In the directory containing pgmodule.c, run the following command::
     
    58101    -DNO_DIRECT    no direct access methods
    59102    -DNO_LARGE     no large object support
    60     -DNO_SNPRINTF  if running a system with no snprintf call
    61103    -DNO_PQSOCKET  if running an older PostgreSQL
    62104
     
    65107
    66108  Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4
    67   that does not have the PQsocket function.  The other options will be
     109  that does not have the PQsocket function. The other options will be
    68110  described in the next sections.
    69111
    70 * Test the new module.  Something like the following should work::
     112* Test the new module. Something like the following should work::
    71113
    72114    $ python
     
    83125
    84126* Finally, move the _pg.so, pg.py, and pgdb.py to a directory in your
    85   PYTHONPATH.  A good place would be /usr/lib/python/site-python if
     127  PYTHONPATH. A good place would be /usr/lib/python/site-packages if
    86128  your Python modules are in /usr/lib/python.
    87129
    88130Built-in to Python interpreter
    89 ==============================
     131------------------------------
    90132
    91133* Find the directory where your 'Setup' file lives (usually ??/Modules) in
     
    105147    -DNO_DIRECT    no direct access methods
    106148    -DNO_LARGE     no large object support
    107     -DNO_SNPRINTF  if running a system with no snprintf call
    108149    -DNO_PQSOCKET  if running an older PostgreSQL
    109150
    110151  Define NO_PQSOCKET if you are using a version of PostgreSQL before 6.4
    111   that does not have the PQsocket function.  The other options will be
     152  that does not have the PQsocket function. The other options will be
    112153  described in the next sections.
    113154
    114155* If you want a shared module, make sure that the "*shared*" keyword is
    115   uncommented and add the above line below it.  You used to need to install
    116   your shared modules with "make sharedinstall but this no longer seems
    117   to be true."
     156  uncommented and add the above line below it. You used to need to install
     157  your shared modules with ``make sharedinstall`` but this no longer seems
     158  to be true.
    118159
    119160* Copy pg.py to the lib directory where the rest of your modules are. For
     
    121162
    122163* Rebuild Python from the root directory of the Python source hierarchy by
    123   running 'make -f Makefile.pre.in boot' and 'make && make install'
     164  running ``make -f Makefile.pre.in boot' and 'make && make install``.
    124165
    125166* For more details read the documentation at the top of Makefile.pre.in
Note: See TracChangeset for help on using the changeset viewer.