From e91262320eafb3b437af754133255d96f0c9c74e Mon Sep 17 00:00:00 2001 From: Dimitris Zlatanidis Date: Tue, 26 May 2015 06:49:04 +0300 Subject: [PATCH] pass paths to metadata --- setup.py | 23 ++++++++++------------- slpkg/__metadata__.py | 7 +++++++ 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/setup.py b/setup.py index 0324e3aa..7777dda3 100755 --- a/setup.py +++ b/setup.py @@ -65,9 +65,8 @@ setup( # install man page and configuration files if "install" in sys.argv: - man_path = "/usr/man/man8/" - if not os.path.exists(man_path): - os.makedirs(man_path) + if not os.path.exists(_m.man_path): + os.makedirs(_m.man_path) man_page = "man/slpkg.8" gzip_man = "man/slpkg.8.gz" print("Installing '{0}' man pages".format(gzip_man.split('/')[1])) @@ -76,23 +75,21 @@ if "install" in sys.argv: f_out.writelines(f_in) f_out.close() f_in.close() - shutil.copy2(gzip_man, man_path) + shutil.copy2(gzip_man, _m.man_path) - bash_completion = "/etc/bash_completion.d/" - fish_completion = "/etc/fish/completions/" completion_file = [ 'conf/slpkg.bash-completion', 'conf/slpkg.fish' ] - if not os.path.exists(bash_completion): - os.makedirs(bash_completion) + if not os.path.exists(_m.bash_completion): + os.makedirs(_m.bash_completion) print("Installing '{0}' file".format(completion_file[0].split('/')[1])) - shutil.copy2(completion_file[0], bash_completion) - os.chmod(bash_completion + completion_file[0].split('/')[1], 744) - if os.path.exists(fish_completion): + shutil.copy2(completion_file[0], _m.bash_completion) + os.chmod(_m.bash_completion + completion_file[0].split('/')[1], 744) + if os.path.exists(_m.fish_completion): print("Installing '{0}' file".format(completion_file[1].split('/')[1])) - shutil.copy2(completion_file[1], fish_completion) - os.chmod(fish_completion + completion_file[1].split('/')[1], 744) + shutil.copy2(completion_file[1], _m.fish_completion) + os.chmod(_m.fish_completion + completion_file[1].split('/')[1], 744) conf_file = [ 'conf/slpkg.conf', 'conf/blacklist', diff --git a/slpkg/__metadata__.py b/slpkg/__metadata__.py index 632e09eb..79732073 100644 --- a/slpkg/__metadata__.py +++ b/slpkg/__metadata__.py @@ -224,6 +224,13 @@ class MetaData(object): # slackpkg conf path slackpkg_conf = "/etc/slackpkg/" + # slpkg man path + man_path = "/usr/man/man8/" + + # bash and fish completion files + bash_completion = "/etc/bash_completion.d/" + fish_completion = "/etc/fish/completions/" + # computer architecture arch = os.uname()[4]