def test_version(): nonex = '/etc/non/exist/dir/modfoo-1.1' sys.path.append(nonex) pkgloader.require('modfoo', '2.0') import modfoo eq_(modfoo.__version__, '2.2') pkgloader.require('modfoo', '2.0') assert_raises(ImportError, pkgloader.require, 'modfoo', '3.0') assert_false(nonex in sys.path)
#! /usr/bin/env python """Londiste launcher. """ import sys, os, os.path, optparse import pkgloader pkgloader.require('skytools', '3.0') import skytools # python 2.3 will try londiste.py first... if os.path.exists(os.path.join(sys.path[0], 'londiste.py')) \ and not os.path.isdir(os.path.join(sys.path[0], 'londiste')): del sys.path[0] import londiste, pgq.cascade.admin command_usage = pgq.cascade.admin.command_usage + """ Replication Daemon: worker replay events to subscriber Replication Administration: add-table TBL ... add table to queue remove-table TBL ... remove table from queue add-seq SEQ ... add sequence to provider remove-seq SEQ ... remove sequence from provider tables show all tables on provider seqs show all sequences on provider missing list tables subscriber has not yet attached to
#! /usr/bin/env python """Upgrade script for versioned schemas.""" import sys, os, re import pkgloader pkgloader.require('skytools', '3.0') import skytools ver_rx = r"(\d+)([.](\d+)([.](\d+))?)?" ver_rc = re.compile(ver_rx) def detect_londiste215(curs): return skytools.exists_table(curs, 'londiste.subscriber_pending_fkeys') version_list = [ ['pgq', '2.1.5', 'v2.1.5_pgq_core.sql', None], # those vers did not have version func ['pgq_ext', '2.1.5', 'v2.1.5_pgq_ext.sql', None], # ok to reapply ['londiste', '2.1.5', 'v2.1.5_londiste.sql', detect_londiste215], # not ok to reapply ['pgq_ext', '2.1.6', 'v2.1.6_pgq_ext.sql', None], ['londiste', '2.1.6', 'v2.1.6_londiste.sql', None], ['pgq', '2.1.7', 'v2.1.7_pgq_core.sql', None], ['londiste', '2.1.7', 'v2.1.7_londiste.sql', None], ['pgq', '2.1.8', 'v2.1.8_pgq_core.sql', None], ]
def test_unknown(): pkgloader.require('unknown', '2.0')
#! /usr/bin/env python """Londiste launcher. """ import sys, os, os.path, optparse import pkgloader pkgloader.require("skytools", "3.0") import skytools # python 2.3 will try londiste.py first... if os.path.exists(os.path.join(sys.path[0], "londiste.py")) and not os.path.isdir( os.path.join(sys.path[0], "londiste") ): del sys.path[0] import londiste, pgq.cascade.admin command_usage = ( pgq.cascade.admin.command_usage + """ Replication Daemon: worker replay events to subscriber Replication Administration: add-table TBL ... add table to queue remove-table TBL ... remove table from queue add-seq SEQ ... add sequence to provider