From d9ab616a17bb47f89b0cb8a5e0217b0885f32405 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Wed, 17 Aug 2016 15:49:53 -0300 Subject: [PATCH 1/3] Check if apprec-apt is on /user/bin/ into apt hook --- 99app-recommender | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/99app-recommender b/99app-recommender index 40eed3d..32fb574 100644 --- a/99app-recommender +++ b/99app-recommender @@ -1,2 +1,2 @@ -DPkg::Post-Invoke {"apprec-apt --post-invoke";}; -DPkg::Pre-Install-Pkgs {"apprec-apt --pre-install-pkgs";}; +DPkg::Post-Invoke {"[ ! -x /usr/bin/apprec-apt ] || apprec-apt --post-invoke";}; +DPkg::Pre-Install-Pkgs {"[ ! -x /usr/bin/apprec-apt ] || apprec-apt --pre-install-pkgs";}; From 4834c8aea60e9be984d7cbaaf94eb0d88c7d26c4 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Wed, 17 Aug 2016 16:01:30 -0300 Subject: [PATCH 2/3] Set default base_dir to /var/lib/apprecommender --- .gitlab-ci.yml | 4 ++-- apprecommender/config.py | 6 +++--- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5407e25..651f6bc 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,8 +1,8 @@ before_script: - ./install_dependencies.sh - sudo pip2 install flake8 - - /usr/bin/python2 -m apprecommender.main.cli --init - - /usr/bin/python2 -m apprecommender.main.cli --train + - sudo /usr/bin/python2 -m apprecommender.main.cli --init + - sudo /usr/bin/python2 -m apprecommender.main.cli --train test: script: diff --git a/apprecommender/config.py b/apprecommender/config.py index c583ae6..c12aced 100644 --- a/apprecommender/config.py +++ b/apprecommender/config.py @@ -45,7 +45,7 @@ def __init__(self): ['/etc/apprecommender/recommender.conf', os.path.expanduser('~/.app_recommender.rc'), os.path.expanduser('app_recommender.cfg')]) - self.home_dir = os.path.expanduser('~/.app-recommender') + self.home_dir = os.path.expanduser('~/.apprecommender') except (MissingSectionHeaderError), err: logging.error("Error in config file syntax: %s", str(err)) @@ -53,7 +53,7 @@ def __init__(self): if not hasattr(self, 'initialized'): # data_source options self.base_dir = os.environ.get( - 'APPREC_DATA', '~/.apprecommender') + 'APPREC_DATA', '/var/lib/apprecommender') self.base_dir = os.path.expanduser(self.base_dir) self.output = os.path.join(self.home_dir, 'apprec.log') self.user_data_dir = os.path.join(self.base_dir, "user_data/") @@ -129,7 +129,7 @@ def load_config_file(self): self.debug = int(self.read_option('general', 'debug')) self.debug = int(self.read_option('general', 'verbose')) self.base_dir = os.environ.get( - 'APPREC_DATA', '~/.apprecommender') + 'APPREC_DATA', '/var/lib/apprecommender') self.base_dir = os.path.expanduser(self.base_dir) self.output = os.path.join( self.home_dir, self.read_option('data_sources', From e8619bd87d4334a046d216028396e18949969943 Mon Sep 17 00:00:00 2001 From: Luciano Prestes Cavalcanti Date: Wed, 17 Aug 2016 16:20:36 -0300 Subject: [PATCH 3/3] Add script to run on development --- run_from_source | 3 +++ 1 file changed, 3 insertions(+) create mode 100755 run_from_source diff --git a/run_from_source b/run_from_source new file mode 100755 index 0000000..fa971f3 --- /dev/null +++ b/run_from_source @@ -0,0 +1,3 @@ +#!/bin/sh + +APPREC_DATA=~/.apprecommender python -m apprecommender.main.cli $@