mirror of https://github.com/cheat/cheat.git
Addressing cross-platform installation issues
Attempted to address various cross-platform installation issues: - Removed all hard-coded references to file-paths, and replaced them with paths provided by `appdirs`. - Removed (erroneously inserted) default file paths which would never be checked due to application logic. - Modified `setup.py` to no longer install a configuration file. The mechanics are still in place to **read** a configuration file, but after examination, I've concluded that the installation of that file is best left to package maintainers rather than `cheat` itself.
This commit is contained in:
parent
89bb9aaf13
commit
f692c8e1d8
|
@ -11,12 +11,10 @@ class Configuration:
|
||||||
config_file_path_global = self._select([
|
config_file_path_global = self._select([
|
||||||
os.environ.get('CHEAT_GLOBAL_CONF_PATH'),
|
os.environ.get('CHEAT_GLOBAL_CONF_PATH'),
|
||||||
appdirs.site_config_dir('cheat', 'cheat'),
|
appdirs.site_config_dir('cheat', 'cheat'),
|
||||||
'/etc/cheat',
|
|
||||||
])
|
])
|
||||||
config_file_path_local = self._select([
|
config_file_path_local = self._select([
|
||||||
os.environ.get('CHEAT_LOCAL_CONF_PATH'),
|
os.environ.get('CHEAT_LOCAL_CONF_PATH'),
|
||||||
appdirs.user_config_dir('cheat', 'cheat'),
|
appdirs.user_config_dir('cheat', 'cheat'),
|
||||||
os.path.expanduser('~/.config/cheat/cheat'),
|
|
||||||
])
|
])
|
||||||
|
|
||||||
# attempt to read the global config file
|
# attempt to read the global config file
|
||||||
|
@ -56,7 +54,6 @@ class Configuration:
|
||||||
os.environ.get('CHEAT_USER_DIR'),
|
os.environ.get('CHEAT_USER_DIR'),
|
||||||
os.environ.get('CHEAT_DEFAULT_DIR'),
|
os.environ.get('CHEAT_DEFAULT_DIR'),
|
||||||
os.environ.get('DEFAULT_CHEAT_DIR'),
|
os.environ.get('DEFAULT_CHEAT_DIR'),
|
||||||
# TODO: XDG home?
|
|
||||||
os.path.expanduser(
|
os.path.expanduser(
|
||||||
os.path.expandvars(os.path.join('~', '.cheat'))
|
os.path.expandvars(os.path.join('~', '.cheat'))
|
||||||
),
|
),
|
||||||
|
@ -86,8 +83,6 @@ class Configuration:
|
||||||
os.environ.get('CHEATPATH'),
|
os.environ.get('CHEATPATH'),
|
||||||
config.get('CHEAT_PATH'),
|
config.get('CHEAT_PATH'),
|
||||||
appdirs.user_data_dir('cheat', 'cheat'),
|
appdirs.user_data_dir('cheat', 'cheat'),
|
||||||
appdirs.site_data_dir('cheat', 'cheat'),
|
|
||||||
'/usr/share/cheat',
|
|
||||||
])
|
])
|
||||||
|
|
||||||
def _read_config_file(self, path):
|
def _read_config_file(self, path):
|
||||||
|
|
8
setup.py
8
setup.py
|
@ -1,4 +1,4 @@
|
||||||
from cheat.appdirs import user_config_dir, user_data_dir
|
from cheat.appdirs import user_data_dir
|
||||||
from distutils.core import setup
|
from distutils.core import setup
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
@ -7,11 +7,6 @@ import os
|
||||||
cheat_path = os.environ.get('CHEAT_PATH') or \
|
cheat_path = os.environ.get('CHEAT_PATH') or \
|
||||||
user_data_dir('cheat', 'cheat')
|
user_data_dir('cheat', 'cheat')
|
||||||
|
|
||||||
# determine the path in which to install the config file
|
|
||||||
config_path = os.environ.get('CHEAT_GLOBAL_CONF_PATH') or \
|
|
||||||
os.environ.get('CHEAT_LOCAL_CONF_PATH') or \
|
|
||||||
user_config_dir('cheat', 'cheat')
|
|
||||||
|
|
||||||
# aggregate the systme-wide cheatsheets
|
# aggregate the systme-wide cheatsheets
|
||||||
cheat_files = []
|
cheat_files = []
|
||||||
for f in os.listdir('cheat/cheatsheets/'):
|
for f in os.listdir('cheat/cheatsheets/'):
|
||||||
|
@ -41,6 +36,5 @@ setup(
|
||||||
],
|
],
|
||||||
data_files=[
|
data_files=[
|
||||||
(cheat_path, cheat_files),
|
(cheat_path, cheat_files),
|
||||||
(config_path, ['config/cheat']),
|
|
||||||
],
|
],
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue