Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Linux] Source configuration/data from standard locations #792

Open
ainola opened this issue Sep 9, 2018 · 6 comments
Open

[Linux] Source configuration/data from standard locations #792

ainola opened this issue Sep 9, 2018 · 6 comments

Comments

@ainola
Copy link

ainola commented Sep 9, 2018

Presently, GAM uses its own directory structure; however if one wants to package this application for system installation, GAM will not (and should not) have access to alter its installation directories. GAM should be looking in standard Linux configuration directories: $XDG_CONFIG_HOME/gam/<configfile> if available, then /etc/gam/<configfile> for the system defaults. Individual user tokens should be sourced from $XDG_CONFIG_HOME/gam/<tokenfile> (and the program should refuse to work if the token is world-readable).

These changes would allow packaging into Archlinux for users to install.

@ainola
Copy link
Author

ainola commented Sep 9, 2018

Here's a hacky example that is currently applied to the Arch Linux AUR package:

--- src/var.py	2018-08-03 14:30:31.000000000 -0600
+++ src/var.py	2018-08-11 12:02:27.184546770 -0600
@@ -20,6 +20,18 @@
 GAM_LATEST_RELEASE = GAM_ALL_RELEASES+u'/latest'
 GAM_PROJECT_APIS = u'https://raw.githubusercontent.com/jay0lee/GAM/master/src/project-apis.txt'
 
+try:
+    XDG_CONFIG_DIR = os.environ['XDG_CONFIG_HOME']
+except KeyError:
+    XDG_CONFIG_DIR = os.path.expanduser("~") + '/.config/'
+CONFIG_DIR = unicode(XDG_CONFIG_DIR) + u'gam/'
+
+try:
+    os.makedirs(CONFIG_DIR, mode=0700)
+except OSError:
+    if not os.path.isdir(CONFIG_DIR):
+        raise
+
 TRUE = u'true'
 FALSE = u'false'
 true_values = [u'on', u'yes', u'enabled', u'true', u'1']

@timwsuqld
Copy link

@ainola is it worth submitting this as a patch to see if it'll be merged in?

@ainola
Copy link
Author

ainola commented May 14, 2019

The hack certainly is better than nothing for the AUR package but I'm afraid larger-scale changes need to happen before this gets merged in. For one, the logic for saving the token is broken IIRC and one needs to generate it with the incumbent method and move the tokens manually.

I think GAM needs to adopt the mentality of a system package rather than standalone; Now that there's an effort underway to clean up the codebase it very well may be worth our time to standardize locations (XDG directories for Linux, Library for mac, etc).

@stale
Copy link

stale bot commented Mar 5, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Mar 5, 2020
@ainola
Copy link
Author

ainola commented Mar 6, 2020

This is absolutely still relevant.

@stale stale bot removed the wontfix label Mar 6, 2020
@stale
Copy link

stale bot commented Jun 4, 2020

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs.

@stale stale bot added the wontfix label Jun 4, 2020
archlinux-github pushed a commit to archlinux/aur that referenced this issue Nov 15, 2023
My attempt to revive this package and make it work.
The upstram project author focuses mainly on binary
distribution.

The biggest problem imho in packing this is storing credentials
in users config dir and NOT in gam.py folder. Previous maintaner
tried to bring the issue (GAM-team/GAM#792),
but nobody seems to be bothered to do something about it.

The xdg_config_dirs.patch works good enough for me to try
maintaning this package.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants