diff options
author | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-08-13 11:47:12 +0200 |
---|---|---|
committer | Emilio Pozuelo Monfort <pochu@debian.org> | 2020-08-13 11:49:08 +0200 |
commit | f815d2033d464c3838f07188b8aa0ce773b6e57b (patch) | |
tree | e11f5594ad35aa4b6d13c0624a667ee3d6ccd88e /bin/update-db | |
parent | 71313afc95839aafa97534d37995156f19eb2ce4 (diff) |
De-duplicate setup_path
All the scripts in bin/ can share the definition. Also
setup_paths.py calls setup_path so one just has to import
that module before importing those from lib/python/.
Additionally this helps some scripts work better under Python 3,
as one variant of setup_paths that we had called string.rfind,
which is not present there.
Diffstat (limited to 'bin/update-db')
-rwxr-xr-x | bin/update-db | 17 |
1 files changed, 1 insertions, 16 deletions
diff --git a/bin/update-db b/bin/update-db index 71603d9ee1..e6da4322ed 100755 --- a/bin/update-db +++ b/bin/update-db @@ -1,24 +1,9 @@ #!/usr/bin/python3 from __future__ import print_function -import os -import os.path -import string import sys -def setup_paths(): - check_file = 'lib/python/debian_support.py' - path = os.getcwd() - while 1: - if os.path.exists("%s/%s" % (path, check_file)): - sys.path = [path + '/lib/python'] + sys.path - return path - idx = string.rfind(path, '/') - if idx == -1: - raise ImportError("could not setup paths") - path = path[0:idx] -os.chdir(setup_paths()) - +import setup_paths import bugs import debian_support import security_db |