from portage.output import bold, red, blue, yellow, green, nocolor
-from stuff import scan
-from collect import prepare_search_dirs, parse_revdep_config, collect_libraries_from_dir, collect_binaries_from_dir
-from assign import assign_packages
-from cache import save_cache
+from .stuff import scan
+from .collect import prepare_search_dirs, parse_revdep_config, collect_libraries_from_dir, collect_binaries_from_dir
+from .assign import assign_packages
+from .cache import save_cache
def prepare_checks(files_to_check, libraries, bits, cmd_max_args):
import time
from portage.output import red
-from settings import DEFAULTS
+from .settings import DEFAULTS
def read_cache(temp_path=DEFAULTS['DEFAULT_TMP_DIR']):
ret = {'libraries':[], 'la_libraries':[], 'libraries_links':[], 'binaries':[]}
try:
- for key,val in ret.iteritems():
+ for key,val in list(ret.items()):
f = open(os.path.join(temp_path, key))
for line in f.readlines():
val.append(line.strip())
f.write(str(int(time.time())))
f.close()
- for key,val in to_save.iteritems():
+ for key,val in list(to_save.items()):
f = open(os.path.join(temp_path, key), 'w')
for line in val:
f.write(line + '\n')
if __name__ == '__main__':
print('Preparing cache ... ')
- from collect import *
+ from .collect import *
import logging
bin_dirs, lib_dirs = prepare_search_dirs()
lib_dirs = set()
to_parse = set()
- if isinstance(conf_file, basestring):
+ if isinstance(conf_file, str):
conf_file = [conf_file]
for conf in conf_file:
from portage import portdb
from portage.output import bold, red, blue, yellow, green, nocolor
-from analyse import analyse
-from stuff import exithandler, get_masking_status
-from cache import check_temp_files, read_cache
-from assign import get_slotted_cps
-from settings import DEFAULTS
-from gentoolkit.revdep_rebuild import __version__
+from .analyse import analyse
+from .stuff import exithandler, get_masking_status
+from .cache import check_temp_files, read_cache
+from .assign import get_slotted_cps
+from .settings import DEFAULTS
+from . import __version__
APP_NAME = sys.argv[0]
# util. functions
def call_program(args):
- ''' Calls program with specified parameters and returns stdout '''
+ ''' Calls program with specified parameters and returns stdout as a str object '''
subp = subprocess.Popen(args, stdout=subprocess.PIPE, \
stderr=subprocess.PIPE)
stdout, stderr = subp.communicate()
- return stdout
+ return str(stdout)
def scan(params, files, max_args):