Control: retitle -1 Document SYMPOW_CACHEDIR better and automatically try to create it
Jerome BENOIT: > Hello SymPow enthusiasts, > > On 17/12/16 15:46, Jerome BENOIT wrote: >>> It would be good if sympow could automatically create SYMPOW_CACHEDIR >>>> if it doesn't exist. Otherwise, I would have to add this logic to >>>> Sage, which seems a bit unclean. >> I not so sure that it is a good idea to create SYMPOW_CACHEDIR on the fly. >> Not that if SYMPOW_CACHEDIR does not exist, an appropraite message is >> printed. > >>> > I am on my way to add a mechanism to create SYMPOW_CACHEDIR on the fly > (that may avoid to add a dirty trick on Sage). > Hey, thanks for this. To explain in some more detail: at the moment I have to patch Sage like this: sage/src/sage/lfunctions/sympow.py: - cmd = 'sympow %s'%args + cmd = 'env HOME="%s" sympow %s' % (DOT_SAGE, args) Setting HOME is ugly, it would be nicer to do this instead: - cmd = 'sympow %s'%args + cmd = 'env SYMPOW_CACHEDIR="%s" sympow %s' % (os.path.join(DOT_SAGE, "sympow"), args) However I can't, because sympow does not automatically create SYMPOW_CACHEDIR. I would have to do this instead: - cmd = 'sympow %s'%args + cmd = 'mkdir "{0}" && env SYMPOW_CACHEDIR="{0}" sympow {1}'.format(os.path.join(DOT_SAGE, "sympow"), args) Note, it's not necessary to create all the parent directories like what `mkdir -p` does. That is, if `dirname $SYMPOW_CACHEDIR` does not exist, I think it's fine that sympow fails - because there is no way to know what permissions (etc) to create parent directories with, it is a sysadmin and local policy issue, and it means there is a bug somewhere else. However if `dirname $SYMPOW_CACHEDIR` does exist, then sympow should try to create SYMPOW_CACHEDIR inside it - it "controls" this directory, so it knows what permissions to use. So actually, I think there is no bug in sympow regarding non-existent HOME. It is OK to fail, if HOME does not exist and SYMPOW_CACHEDIR is not set. It is better that during tests, SYMPOW_CACHEDIR is set explicitly in a Makefile, or by the parent process (Sage) which already has a "directory for testing" (DOT_SAGE). X -- GPG: ed25519/56034877E1F87C35 GPG: rsa4096/1318EFAC5FBBDBCE https://github.com/infinity0/pubkeys.git -- debian-science-maintainers mailing list debian-science-maintainers@lists.alioth.debian.org http://lists.alioth.debian.org/cgi-bin/mailman/listinfo/debian-science-maintainers