]> git.rkrishnan.org Git - tahoe-lafs/tahoe-lafs.git/blob - misc/build_helpers/test-with-fake-pkg.py
d4ae7311db23903d516da1f3bdb0abb350f8da87
[tahoe-lafs/tahoe-lafs.git] / misc / build_helpers / test-with-fake-pkg.py
1 #!/usr/bin/env python
2
3 # We put a fake "pycryptopp-0.5.13" package on the PYTHONPATH so that
4 # the build system thinks pycryptopp-0.5.13 is already installed. Then
5 # we execute run_trial.py. If the build system is too naive/greedy
6 # about finding dependencies, it will latch onto the
7 # "pycryptopp-0.5.13" and then will be unable to satisfy the
8 # requirement (from _auto_deps.py) for pycryptopp >= 0.5.20 (or
9 # pycryptopp >= 0.5.14, depending on machine architecture). This is
10 # currently happening on trunk, see #1190. So with trunk, running
11 # test-with-fake-pkg.py shows a failure, but with the ticket1190
12 # branch, test-with-fake-pkg.py succeeds.
13
14 import glob, os, subprocess, sys
15
16 fakepkgdir = 'misc/build_helpers/fakepkgs'
17 fakepkgname = "pycryptopp"
18 fakepkgversion = "0.5.13"
19 testsuite = "allmydata.test.test_backupdb"
20
21 pkgdirname = os.path.join(os.getcwd(), fakepkgdir, '%s-%s.egg' % (fakepkgname, fakepkgversion))
22
23 try:
24     os.makedirs(pkgdirname)
25 except OSError:
26     # probably already exists
27     pass
28 os.chdir('src')
29 trial=os.path.join(os.getcwd(), '..', 'misc', 'build_helpers', 'run_trial.py')
30 os.environ['PATH']=os.getcwd()+os.pathsep+os.environ['PATH']
31 eggs = [os.path.realpath(p) for p in glob.glob(os.path.join('..', '*.egg'))]
32 os.environ['PYTHONPATH']=os.pathsep+pkgdirname+os.pathsep+os.pathsep.join(eggs)+os.pathsep+os.environ.get('PYTHONPATH','')
33 sys.exit(subprocess.call([sys.executable, trial, testsuite], env=os.environ))