Commits

Kirill Simonov committed df12116

Remove the fallback to `pysqlite2` as `sqlite3` is provided in Python 2.5+.

  • Participants
  • Parent commits a5b302f

Comments (0)

Files changed (6)

 # This makefile provides various build, installation and testing tasks.
 
-.PHONY: default build install develop doc dist windist pypi clean \
-	test train train-routine train-sqlite train-pgsql train-mysql \
-	train-oracle train-mssql purge-test lint \
+.PHONY: default build install deps develop doc dist windist pypi clean \
+	test train test-routine train-routine test-sqlite train-sqlite \
+	test-pgsql train-pgsql test-mysql train-mysql test-oracle train-oracle \
+	test-mssql train-mssql purge-test lint \
 	create-sqlite create-pgsql create-mysql create-oracle create-mssql \
 	drop-sqlite drop-pgsql drop-mysql drop-oracle drop-mssql \
-	build-all start-pgsql84 start-pgsql90 start-mysql51 start-oracle10g \
-	start-mssql2005 start-mssql2008 stop-pgsql84 stop-pgsql90 stop-mysql51 \
-	stop-oracle10g stop-mssql2005 stop-mssql2008 gdemo-htraf demo-ssi \
-	shell-sqlite shell-pgsql shell-mysql shell-oracle shell-mssql \
-	serve-sqlite serve-pgsql serve-mysql serve-oracle serve-mssql \
+	build-all check-all start-pgsql84 start-pgsql90 start-mysql51 \
+	start-oracle10g start-mssql2005 start-mssql2008 stop-pgsql84 stop-pgsql90 \
+	stop-mysql51 stop-oracle10g stop-mssql2005 stop-mssql2008 \
+	demo-htraf demo-ssi shell-sqlite shell-pgsql shell-mysql shell-oracle \
+	shell-mssql serve-sqlite serve-pgsql serve-mysql serve-oracle serve-mssql \
 	client-sqlite client-pgsql client-mysql client-oracle client-mssql
 
 
 	@echo "  update: to update the HTSQL source code"
 	@echo "  build: to build the HTSQL packages"
 	@echo "  install: to install the HTSQL packages"
+	@echo "  deps: to install database drivers"
 	@echo "  develop: to install the HTSQL packages in the development mode"
 	@echo "  doc: to build the HTSQL documentation"
 	@echo "  dist: to build a source and an EGG distribution"
 	@echo "  *** Regression Testing ***"
 	@echo "  test: to run HTSQL regression tests"
 	@echo "  train: to run all HTSQL tests in the train mode"
+	@echo "  test-<suite>: to run a specific test suite"
 	@echo "  train-<suite>: to run a specific test suite in the train mode"
 	@echo "    where <suite> is one of:"
 	@echo "      routine, sqlite, pgsql, mysql, oracle, mssql"
 	@echo
 	@echo "  *** Integration Testing ***"
 	@echo "  build-all: to build all test benches"
+	@echo "  check-all: run HTSQL regression tests on all supported platforms"
 	@echo "  start-<bench>: to start the specified test bench"
 	@echo "  stop-<bench>: to stop the specified test bench"
 	@echo "    where <bench> is one of:"
-	@echo "      pgsql84, pgsql90, mysql51, oracle10g, mssql2005, mssql2008"
+	@echo "      py25, py26, pgsql84, pgsql90, mysql51, oracle10g,"
+	@echo "      mssql2005, mssql2008"
 	@echo
 	@echo "  *** Shell and Server ***"
 	@echo "  shell-<db>: to start the HTSQL shell on the specified test database"
 install:
 	${PYTHON} setup.py install
 
+# Install database drivers.
+deps:
+	#if ! ${PYTHON} -c 'import sqlite3' >/dev/null 2>&1 && \
+	#	! ${PYTHON} -c 'import pysqlite2' >/dev/null 2>&1; then \
+	#	${PIP} install pysqlite; fi
+	if ! ${PYTHON} -c 'import psycopg2'; then \
+		${PIP} install psycopg2; fi
+	if ! ${PYTHON} -c 'import MySQLdb'; then \
+		${PIP} install mysql-python; fi
+	if ! ${PYTHON} -c 'import pymssql'; then \
+		${PIP} install pymssql \
+		-f http://pypi.python.org/pypi/pymssql/ --no-index; fi
+	if ! ${PYTHON} -c 'import cx_Oracle'; then \
+		${PIP} install cx-oracle; fi
+
 # Install the HTSQL packages in the development mode.
 develop:
 	${PYTHON} setup.py develop
 train:
 	${HTSQL_CTL} regress -i test/regress.yaml --train
 
+# Run regression tests for htsql-ctl tool.
+test-routine:
+	${HTSQL_CTL} regress -i test/regress.yaml -q routine
+
 # Run regression tests for htsql-ctl tool in the train mode.
 train-routine:
 	${HTSQL_CTL} regress -i test/regress.yaml --train routine
 
+# Run SQLite-specific regression tests.
+test-sqlite:
+	${HTSQL_CTL} regress -i test/regress.yaml -q sqlite
+
 # Run SQLite-specific regression tests in the train mode.
 train-sqlite:
 	${HTSQL_CTL} regress -i test/regress.yaml --train sqlite
 
+# Run PostgreSQL-specific regression tests.
+test-pgsql:
+	${HTSQL_CTL} regress -i test/regress.yaml -q pgsql
+
 # Run PostgreSQL-specific regression tests in the train mode.
 train-pgsql:
 	${HTSQL_CTL} regress -i test/regress.yaml --train pgsql
 
+# Run MySQL-specific regression tests.
+test-mysql:
+	${HTSQL_CTL} regress -i test/regress.yaml -q mysql
+
 # Run MySQL-specific regression tests in the train mode.
 train-mysql:
 	${HTSQL_CTL} regress -i test/regress.yaml --train mysql
 
+# Run Oracle-specific regression tests.
+test-oracle:
+	${HTSQL_CTL} regress -i test/regress.yaml -q oracle
+
 # Run Oracle-specific regression tests in the train mode.
 train-oracle:
 	${HTSQL_CTL} regress -i test/regress.yaml --train oracle
 
+# Run MS SQL Server-specific regression tests.
+test-mssql:
+	${HTSQL_CTL} regress -i test/regress.yaml -q mssql
+
 # Run MS SQL Server-specific regression tests in the train mode.
 train-mssql:
 	${HTSQL_CTL} regress -i test/regress.yaml --train mssql
 build-all:
 	./test/buildbot/bb.sh build
 
+# Run regression tests on all combinations of test benches.
+check-all:
+	./test/buildbot/bb.sh check
+
+# Start the test bench for Python 2.5
+start-py25:
+	./test/buildbot/bb.sh start py25
+
+# Start the test bench for Python 2.6
+start-py26:
+	./test/buildbot/bb.sh start py26
+
 # Start the test bench for PostgreSQL 8.4
 start-pgsql84:
 	./test/buildbot/bb.sh start pgsql84
 start-mssql2008:
 	./test/buildbot/bb.sh start mssql2008
 
+# Stop the test bench for Python 2.5
+stop-py25:
+	./test/buildbot/bb.sh stop py25
+
+# Stop the test bench for Python 2.6
+stop-py26:
+	./test/buildbot/bb.sh stop py26
+
 # Stop the test bench for PostgreSQL 8.4
 stop-pgsql84:
 	./test/buildbot/bb.sh stop pgsql84
 
 PYTHON?=python
 HTSQL_CTL?=htsql-ctl
+PIP?=pip
 SPHINX_BUILD?=sphinx-build
 PYFLAKES?=pyflakes
 

Makefile.env.sample

 # Path to Python executable.
 #PYTHON?=python
 
-# Path to HTSQL-CTL executable.
+# Path to `htsql-ctl` executable.
 #HTSQL_CTL?=htsql-ctl
 
-# Path to SPHINX-BUILD executable.
+# Path to `pip` executable.
+#PIP?=pip
+
+# Path to `sphinx-build` executable.
 #SPHINX_BUILD?=sphinx-build
 
-# Path to PYFLAKES executable.
+# Path to `pyflakes` executable.
 #PYFLAKES?=pyflakes
 
 

src/htsql_sqlite/connect.py

 from htsql.adapter import adapts
 from htsql.context import context
 from htsql.domain import BooleanDomain, StringDomain, DateDomain
-# In Python 2.6, the `sqlite3` module is built-in, but
-# for Python 2.5, we need to import a third-party module.
-try:
-    import sqlite3
-except ImportError:
-    from pysqlite2 import dbapi2 as sqlite3
+import sqlite3
 
 
 class SQLiteError(DBError):

test/buildbot/bb.sh

     set -x
 fi
 
-LINUX_BENCHES="pgsql84 pgsql90 mysql51 oracle10g"
+LINUX_BENCHES="py25 py26 pgsql84 pgsql90 mysql51 oracle10g"
 WINDOWS_BENCHES="mssql2005 mssql2008"
 BENCHES="$LINUX_BENCHES $WINDOWS_BENCHES"
 
     local VM="$1"
     local CMD="$2"
 
-    case $VM_TYPE in
-    linux)
-        local SSH_USER=root;;
-    windows)
-        local SSH_USER=Administrator;;
-    esac
-
     vm_forward $VM :10022-:22
     vm_ctl $VM "hostfwd_add tcp:127.0.0.1:10022-:22"
-    ssh -p 10022 -i $CTL/identity                   \
-        -o 'NoHostAuthenticationForLocalhost yes'   \
-        $SSH_USER@localhost "$CMD" >/dev/null 2>&1
+    case $BUILDBOT_DEBUG in
+    true)
+        ssh -F $CTL/ssh_config $VM_TYPE-vm "$CMD";;
+    *)
+        ssh -F $CTL/ssh_config $VM_TYPE-vm "$CMD" >/dev/null 2>&1;;
+    esac
     vm_unforward $VM :10022-:22
 }
 
     esac
 
     vm_forward $VM :10022-:22
-    scp -P 10022 -i $CTL/identity                   \
-        -o 'NoHostAuthenticationForLocalhost yes'   \
-        "$FROM" $SSH_USER@localhost:"$TO" >/dev/null 2>&1
+    scp -F $CTL/ssh_config "$FROM" $VM_TYPE-vm:"$TO" >/dev/null 2>&1
     vm_unforward $VM :10022-:22
 }
 
         ssh-keygen -q -N "" -f $CTL/identity
     fi
 
+    if [ ! -f "$CTL/ssh_config" ]; then
+        sed -e s#\$BUILDBOT_ROOT#$BUILDBOT_ROOT# $DATA_ROOT/ssh_config >$CTL/ssh_config
+    fi
+
     7z x $TMP/$LINUX_ISO -o$TMP/linux-vm-iso >/dev/null
 
     cp $DATA_ROOT/linux-isolinux.cfg $TMP/linux-vm-iso/isolinux/isolinux.cfg
 
     if found py25 "$LIST"; then
         start_linux_bench py25 :10022-:22
+        echo For remote shell, type \'ssh -F $CTL/ssh_config linux-vm\'
     fi
 
     if found py26 "$LIST"; then
         start_linux_bench py26 :10022-:22
+        echo For remote shell, type \'ssh -F $CTL/ssh_config linux-vm\'
     fi
 
     if found pgsql84 "$LIST"; then

test/buildbot/data/py25-update.sh

 
 echo py25-vm >/etc/hostname
 
-apt-get -qq install mercurial >/dev/null
+echo "deb http://oss.oracle.com/debian/ unstable main non-free" >/etc/apt/sources.list.d/oracle.list
+wget -q http://oss.oracle.com/el4/RPM-GPG-KEY-oracle -O- | apt-key add -
+apt-get update
 
-apt-get -qq install python2.5 >/dev/null
-apt-get -qq install python-setuptools >/dev/null
-apt-get -qq install python-yaml >/dev/null
-apt-get -qq install python-pysqlite2 >/dev/null
-apt-get -qq install python-psycopg2 >/dev/null
-apt-get -qq install python-mysqldb >/dev/null
+apt-get -y install mercurial
 
-hg -q clone https://bitbucket.org/prometheus/htsql
+apt-get -y install python2.5
+apt-get -y install python-setuptools
+apt-get -y install python-yaml
+apt-get -y install python-pip
+apt-get -y install python-virtualenv
 
+apt-get -y install python2.5-dev
+
+apt-get -y install libsqlite3-dev
+apt-get -y install libpq-dev
+apt-get -y install libmysqlclient-dev
+apt-get -y install freetds-dev
+apt-get -y install oracle-xe-client
+
+virtualenv -p python2.5 .
+
+mkdir src
+hg -q clone https://bitbucket.org/prometheus/htsql src/htsql
+
+cat <<END >>/root/.bashrc
+
+export PATH=~/bin:\$PATH
+export LD_LIBRARY_PATH=~/lib
+
+export ORACLE_HOME=/usr/lib/oracle/xe/app/oracle/product/10.2.0/client
+export NLS_LANG=AMERICAN_AMERICA.AL32UTF8
+export SQLPATH=\$ORACLE_HOME/sqlplus
+export PATH=\$PATH:\$ORACLE_HOME/bin
+export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:\$ORACLE_HOME/lib
+
+END
+
+#cat <<END >>/root/.bashrc
+#
+#. /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh
+#END
+
+#. /usr/lib/oracle/xe/app/oracle/product/10.2.0/client/bin/oracle_env.sh
+
+#python2.5 -mpip install pysqlite
+#python2.5 -mpip install psycopg2
+#python2.5 -mpip install mysql-python
+#python2.5 -mpip install pymssql -f http://pypi.python.org/pypi/pymssql/ --no-index
+#python2.5 -mpip install cx-oracle
+
+#python2.5 -c 'import pysqlite2, psycopg2, MySQLdb, pymssql, cx_Oracle'
+
+#apt-get -qq install python-pysqlite2 >/dev/null
+#apt-get -qq install python-psycopg2 >/dev/null
+#apt-get -qq install python-mysqldb >/dev/null
+
+