From a51f0ac2888bb7da475af291f77a79fb7f7cd5e0 Mon Sep 17 00:00:00 2001 From: Emilio Pozuelo Monfort Date: Thu, 13 Aug 2020 11:47:12 +0200 Subject: 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. --- bin/apt-update-file | 17 +---------------- 1 file changed, 1 insertion(+), 16 deletions(-) (limited to 'bin/apt-update-file') diff --git a/bin/apt-update-file b/bin/apt-update-file index 617eed2d99..505d23f602 100755 --- a/bin/apt-update-file +++ b/bin/apt-update-file @@ -2,24 +2,9 @@ # This script is mainly used to demo the updateFile function. 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] -root_path = setup_paths() - +import setup_paths import debian_support if len(sys.argv) != 3: -- cgit v1.2.3