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
Support XDG env variables on Android or use default XDG directories on Android/Termux #70
Comments
First of all Termux is Andorid app and all Android apps has directories specificated by Android SDK. We just took the values of such methods as getCacheDir as a standard and turn them back without referring to the sdk. The use of the XDG specification in applications other than Termux is unacceptable. Also I'm not sure how this approach can break current applications and why it cannot be used |
For all intents and purposes, termux is a full unix environment. Moving app specific directories outside their default directories has other issues like inability to access the data through Android storage access framework as termux only exports the Termux Packaging policy: 7 says:
It would be great, if you follow established norms rather than creating new ones. |
I don't create new norms 👍 In addition to termux, there are still a large number of applications using python
They all need to define directories, but they don't have the same file hierarchy as termux, so summarizing all cases, it seems to me more rational to use Android (Google) standards rather than add exceptions for each application. if SAF is your only problem, you can always make a link from home to the directories you need: $ pwd
/data/data/com.termux/files/home
$ ln -s ../../shared_prefs shared_prefs P.S. Android support was added in 2.1.0, not in #63 |
There are two scenarios:
In scenario 1, The pkg can be used on any platform like unix or mac to create In scenario 2, a android app is used to simulate a full linux distro. I would guess more than 95% python packages used in android are only used in Other than SAF:
This is creating a new norm by treating all packages inside termux use the same config directories as the parent app and ignores a parent-child/master-slave relationship. At the very least, |
I think you are confusing something. Platformdirs, of course, directly executed on android, becuse it was packed to APK via p4a or beeware so APKs buit via these packages should be taken into account.
Yes, it has, but methods only determine the path to the internal/external storage, not to specific dirs, e.g. a data/cache and other dirs. Also,
Yes, they may be less popular than Termux, but 1+ million downloads on each (Pydroid, QPython) should say something.
You are talking about backward compatibility, but what kind of compatibility can we talk about if Android was not considered in appdirs. All this is on the shoulders of developers moving from appdirs to platformdirs
Why packages cannot use this directory? All packages data contains in separated folders, and won't conflict with termux xml preferences. Sub-foldering each package, i think, follow
Of course, it can be used, and even polluted, and this won't affect performance in any way. Again, this won't conflict with the Termux settings Summing up, we can say that this approach is a problem for backward compatibility with appdirs, but it is a working for every method of porting python to Android |
The problem I see here is Even if you want to support scenario 1, the use of More importantly, if it fails to find paths using
They're still shells. They have env variables. If it's not required by them to have XDG env vars, it's also not required by them to have If others come across this issue, as a hacky temporary fix for termux, change the android data variable, before
Expect some packages like Since only Python packages are a issue, instead of changing default shell envs, we can also change python The file should be placed in
|
I know, there are a lot of GSIs and ROMs, but I have never seen such a vendor with modified
Yes, it is a hacky way, but it works today correctly. Moreover, android.os.Environment.get* uses the same method of getting directories
It seems to me it would be more correct if you put everything directly on the code, platformdirs always open for PR 👍 |
Not exactly. Termux, Pydroid and other IDEs doesn't have to, just like XDG env variables doesn't need to be present. Termux does have this present, because they're explicitly added to the shell environment for android related unix packages, but it isn't needed and it can be modified easily. Are you willing to break up android support to these two scenarios? Say, check for prefixed environments using |
Doesn't have to? These variables adds to environment of each unix (android) process. Termux creates its own environment, so copies these variables, and as you have already said yourself, removal or modification is fraught with
Yep 🤝 |
Today I found that pip can't read my configuration in |
Previous issue #62 with fix #63 messes up all config directories.
Related:
mborsetti/webchanges#28
pypa/pip#10887
The fixed config directory on Termux:
No app should ever store anything outside
$HOME
. The correct config directory should reference$HOME
first and then the config directory:Data structure official reference:
https://github.com/termux/termux-packages/wiki/Termux-file-system-layout
So, Termux dirs should be:
The text was updated successfully, but these errors were encountered: