mirror of
https://git.launchpad.net/~ubuntu-release/britney/+git/britney2-ubuntu
synced 2025-02-10 05:57:28 +00:00
Pre-append $B2dir/pythonX(.Y) to sys.path if it exists
This allows britney to load a python2.7 variant of the C module when run under python2.7. Note for python3, we add "python3" rather than "python3.Y". This is to reflect the include path in the python3 package in the archive. Signed-off-by: Niels Thykier <niels@thykier.net>
This commit is contained in:
parent
b52ff787e0
commit
e7b90af6db
22
britney.py
22
britney.py
@ -190,12 +190,30 @@ import urllib
|
||||
|
||||
import apt_pkg
|
||||
|
||||
from functools import reduce
|
||||
from operator import attrgetter
|
||||
|
||||
if __name__ == '__main__':
|
||||
# Check if there is a python-search dir for this version of
|
||||
# python. If so, use the britney module for that.
|
||||
import os
|
||||
mdir = os.path.dirname(sys.argv[0])
|
||||
if sys.version_info[0] == 3:
|
||||
python_dir = "python3"
|
||||
else:
|
||||
python_dir = "python2.%d" % (sys.version_info[1])
|
||||
idir = os.path.join(mdir, python_dir)
|
||||
if os.path.isdir(idir):
|
||||
print "N: Loading from %s" % python_dir
|
||||
# Insert in front (else current dir is before it, which makes
|
||||
# it useless).
|
||||
sys.path.insert(0, idir)
|
||||
|
||||
from excuse import Excuse
|
||||
from migrationitem import MigrationItem, HintItem
|
||||
from hints import HintCollection
|
||||
from britney import buildSystem
|
||||
from functools import reduce
|
||||
from operator import attrgetter
|
||||
|
||||
|
||||
__author__ = 'Fabio Tranchitella and the Debian Release Team'
|
||||
__version__ = '2.0'
|
||||
|
Loading…
x
Reference in New Issue
Block a user