Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 3DC7D200AEE for ; Wed, 4 May 2016 04:26:01 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 3CD141609F7; Wed, 4 May 2016 04:26:01 +0200 (CEST) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 5CAA71609F5 for ; Wed, 4 May 2016 04:26:00 +0200 (CEST) Received: (qmail 3607 invoked by uid 500); 4 May 2016 02:25:59 -0000 Mailing-List: contact commits-help@hawq.incubator.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@hawq.incubator.apache.org Delivered-To: mailing list commits@hawq.incubator.apache.org Received: (qmail 3595 invoked by uid 99); 4 May 2016 02:25:59 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 May 2016 02:25:59 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 29486C0595 for ; Wed, 4 May 2016 02:25:59 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -3.221 X-Spam-Level: X-Spam-Status: No, score=-3.221 tagged_above=-999 required=6.31 tests=[KAM_ASCII_DIVIDERS=0.8, KAM_LAZY_DOMAIN_SECURITY=1, RCVD_IN_DNSWL_HI=-5, RCVD_IN_MSPIKE_H3=-0.01, RCVD_IN_MSPIKE_WL=-0.01, RP_MATCHES_RCVD=-0.001] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id mNia0eUwvYK3 for ; Wed, 4 May 2016 02:25:56 +0000 (UTC) Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with SMTP id D3BEF5F4ED for ; Wed, 4 May 2016 02:25:54 +0000 (UTC) Received: (qmail 3585 invoked by uid 99); 4 May 2016 02:25:54 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Wed, 04 May 2016 02:25:54 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id 8C6D4E0252; Wed, 4 May 2016 02:25:53 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: rlei@apache.org To: commits@hawq.incubator.apache.org Date: Wed, 04 May 2016 02:25:58 -0000 Message-Id: <49eeaa850538427f961511f41a71410c@git.apache.org> In-Reply-To: References: X-Mailer: ASF-Git Admin Mailer Subject: [6/7] incubator-hawq git commit: HAWQ-672. Add python module pygresql back into hawq workspace archived-at: Wed, 04 May 2016 02:26:01 -0000 http://git-wip-us.apache.org/repos/asf/incubator-hawq/blob/192cff1f/tools/bin/pythonSrc/PyGreSQL-4.0/docs/install.txt ---------------------------------------------------------------------- diff --git a/tools/bin/pythonSrc/PyGreSQL-4.0/docs/install.txt b/tools/bin/pythonSrc/PyGreSQL-4.0/docs/install.txt new file mode 100644 index 0000000..3f19a2c --- /dev/null +++ b/tools/bin/pythonSrc/PyGreSQL-4.0/docs/install.txt @@ -0,0 +1,188 @@ +===================== +PyGreSQL Installation +===================== + +.. sectnum:: +.. contents:: Contents + + +General +======= + +You must first have installed Python and PostgreSQL on your system. +If you want to access remote database only, you don't need to install +the full PostgreSQL server, but only the C interface (libpq). If you +are on Windows, make sure that the directory with libpq.dll is in your +``PATH`` environment variable. + +The current version of PyGreSQL has been tested with Python 2.5 and +PostGreSQL 8.3. Older version should work as well, but you will need +at least Python 2.3 and PostgreSQL 7.4. + +PyGreSQL will be installed as three modules, a dynamic module called +_pg.pyd, and two pure Python wrapper modules called pg.py and pgdb.py. +All three files will be installed directly into the Python site-packages +directory. To uninstall PyGreSQL, simply remove these three files again. + + +Installing from a Binary Distribution +===================================== + +This is the easiest way to install PyGreSQL. + +You can currently download PyGreSQL as Linux RPM, NetBSD package and Windows +installer. Make sure the required Python version of the binary package matches +the Python version you have installed. + +Install the package as usual on your system. + +Note that the documentation is currently only included in the source package. + + +Installing from Source +====================== + +If you want to install PyGreSQL from Source, or there is no binary +package available for your platform, follow these instructions. + +Make sure the Python header files and PostgreSQL client and server header +files are installed. These come usually with the "devel" packages on Unix +systems and the installer executables on Windows systems. + +If you are using a precompiled PostgreSQL, you will also need the pg_config +tool. This is usually also part of the "devel" package on Unix, and will be +installed as part of the database server feature on Windows systems. + +Building and installing with Distutils +-------------------------------------- + +You can build and install PyGreSQL using +`Distutils `_. + +Download and unpack the PyGreSQL source tarball if you haven't already done so. + +Type the following commands to build and install PyGreSQL:: + + python setup.py build + python setup.py install + +If you are using `MinGW `_ to build PyGreSQL under +Microsoft Windows, please note that Python newer version 2.3 is using msvcr71 +instead of msvcrt as its common runtime library. You can allow for that by +editing the file ``%MinGWpath%/lib/gcc/%MinGWversion%/specs`` and changing +the entry that reads ``-lmsvcrt`` to ``-lmsvcr71``. You may also need to copy +``libpq.lib`` to ``libpq.a`` in the PostgreSQL ``lib`` directory. Then use +the following command to build and install PyGreSQL:: + + python setup.py build -c mingw32 install + +Now you should be ready to use PyGreSQL. + +Compiling Manually +------------------ + +The source file for compiling the dynamic module is called pgmodule.c. +You have two options. You can compile PyGreSQL as a stand-alone module +or you can build it into the Python interpreter. + +Stand-Alone +----------- + +* In the directory containing ``pgmodule.c``, run the following command:: + + cc -fpic -shared -o _pg.so -I$PYINC -I$PGINC -I$PSINC -L$PGLIB -lpq pgmodule.c + + where you have to set:: + + PYINC = path to the Python include files + (usually something like /usr/include/python) + PGINC = path to the PostgreSQL client include files + (something like /usr/include/pgsql or /usr/include/postgresql) + PSINC = path to the PostgreSQL server include files + (like /usr/include/pgsql/server or /usr/include/postgresql/server) + PGLIB = path to the PostgreSQL object code libraries (usually /usr/lib) + + If you are not sure about the above paths, try something like:: + + PYINC=`find /usr -name Python.h` + PGINC=`find /usr -name libpq-fe.h` + PSINC=`find /usr -name postgres.h` + PGLIB=`find /usr -name libpq.so` + + If you have the ``pg_config`` tool installed, you can set:: + + PGINC=`pg_config --includedir` + PSINC=`pg_config --includedir-server` + PGLIB=`pg_config --libdir` + + Some options may be added to this line:: + + -DNO_DEF_VAR no default variables support + -DNO_DIRECT no direct access methods + -DNO_LARGE no large object support + -DNO_PQSOCKET if running an older PostgreSQL + + Define ``NO_PQSOCKET`` if you are using a version of PostgreSQL before 6.4 + that does not have the PQsocket function. The other options will be + described in the next sections. + + On some systems you may need to include ``-lcrypt`` in the list of libraries + to make it compile. + +* Test the new module. Something like the following should work:: + + $ python + + >>> import _pg + >>> db = _pg.connect('thilo','localhost') + >>> db.query("INSERT INTO test VALUES ('ping','pong')") + 18304 + >>> db.query("SELECT * FROM test") + eins|zwei + ----+---- + ping|pong + (1 row) + +* Finally, move the ``_pg.so``, ``pg.py``, and ``pgdb.py`` to a directory in + your ``PYTHONPATH``. A good place would be ``/usr/lib/python/site-packages`` + if your Python modules are in ``/usr/lib/python``. + +Built-in to Python interpreter +------------------------------ + +* Find the directory where your ``Setup`` file lives (usually in the ``Modules`` + subdirectory) in the Python source hierarchy and copy or symlink the + ``pgmodule.c`` file there. + +* Add the following line to your 'Setup' file:: + + _pg pgmodule.c -I$PGINC -I$PSINC -L$PGLIB -lpq + + where:: + + PGINC = path to the PostgreSQL client include files (see above) + PSINC = path to the PostgreSQL server include files (see above) + PGLIB = path to the PostgreSQL object code libraries (see above) + + Some options may be added to this line:: + + -DNO_DEF_VAR no default variables support + -DNO_DIRECT no direct access methods + -DNO_LARGE no large object support + -DNO_PQSOCKET if running an older PostgreSQL (see above) + + On some systems you may need to include ``-lcrypt`` in the list of libraries + to make it compile. + +* If you want a shared module, make sure that the ``shared`` keyword is + uncommented and add the above line below it. You used to need to install + your shared modules with ``make sharedinstall`` but this no longer seems + to be true. + +* Copy ``pg.py`` to the lib directory where the rest of your modules are. + For example, that's ``/usr/local/lib/Python`` on my system. + +* Rebuild Python from the root directory of the Python source hierarchy by + running ``make -f Makefile.pre.in boot`` and ``make && make install``. + +* For more details read the documentation at the top of ``Makefile.pre.in``.