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

borg2: use platformdirs python package? #7281

Closed
ThomasWaldmann opened this issue Jan 18, 2023 · 2 comments · Fixed by #7300
Closed

borg2: use platformdirs python package? #7281

ThomasWaldmann opened this issue Jan 18, 2023 · 2 comments · Fixed by #7300
Milestone

Comments

@ThomasWaldmann
Copy link
Member

ThomasWaldmann commented Jan 18, 2023

@RayyanAnsari suggested to use the platformdirs python lib ( https://github.com/platformdirs/platformdirs ) and I had a closer look now:

  • the code quality seems decent, from an experienced developer
  • the amount of code is not much, but also not trivial. it might be also interesting for us that it supports android also (but not sure it is relevant for termux users).
  • some dists have it already packaged, some do not (looked at debian,ubuntu,fedora), so there might be some work for packagers.
  • there is 1 open ticket in their tracker with some discussion whether they use some (macOS) directory correctly or not. macOS user_config_dir goes against OS guidelines tox-dev/platformdirs#98
  • so, i guess we could add it as a python dependency for borg if we can get rid of some of the corresponding code we have.
  • we would need to be careful, so we do not break "borg transfer" when it reads borg1 archives/repos (config/cache access the borg1 way).
  • for borg2 config/cache, we could be incompatible as that would be all-new anyway.
  • it seems to not yet autocreate not-yet existing directories, but guess the maintainer there is open for a PR with that. Auto-create the dirs tox-dev/platformdirs#120
@ThomasWaldmann ThomasWaldmann added this to the 2.0.0b5 milestone Jan 18, 2023
@RonnyPfannschmidt
Copy link
Contributor

I highly recommend the library

@ThomasWaldmann ThomasWaldmann changed the title use platformdirs python package? borg2: use platformdirs python package? Jan 19, 2023
@borgbackup borgbackup deleted a comment from RayyanAnsari Feb 3, 2023
@ThomasWaldmann
Copy link
Member Author

ThomasWaldmann commented Feb 3, 2023

XDG_*_HOME

Not having XDG_*_HOME with platformdirs on macOS caused a bit of a pain (and might also cause upgrade issues).

tox-dev/platformdirs#4

get_base_dir

Guess we need to change a bit how this works in borg:

  • old: use BORG_BASE_DIR env. If not set, make something up from HOME/USER/~.
  • old: the caller does use BORG_DIR, falls back to something in BORG_BASE_DIR, falls back to XDG_HOME, falls back to HOME/USER/~.
  • new: just use BORG_BASE_DIR env, if set, leave everthing else to caller.
  • new: the caller does use BORG_*_DIR, falls back to something in BORG_BASE_DIR, falls back to platformdirs.get_* (which deals with XDG stuff on some platforms).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants