/srv/irclogs.ubuntu.com/2022/04/15/#ubuntustudio-devel.txt

OvenWerk1Eickmeyer: more on the path to module use...14:45
OvenWerk1studio-controls might be installed in /usr/local/14:47
OvenWerk1but the path to modules does not include that14:48
OvenWerk1The only thing I can think of that would deal with this is to put the import statement in main() after we figure out the install path and add the directory our module sits in to sys.path14:50
EickmeyerOvenWerk1: /usr/local = BAD. That's completely against Debian packaging rules.16:33
EickmeyerWe simply can't do that.16:34
OvenWerk1Eickmeyer: I am not packaging... for any directory :)  but if someone chooses to make install they can install in local16:34
EickmeyerSure, that's fine.16:35
OvenWerk1(or opt)16:35
EickmeyerAgain, ew. :)16:35
OvenWerk1The problem becomes that a module would be installed in that directory space and python would not normally look there for it.16:37
OvenWerk1(this may not be totally true, python may detect being run in local and change it's sys.path)16:38
OvenWerk1It would also be nice to be able to test my code "in place" in my development directory tree16:40
EickmeyerPython has paths much like bash, so you can install a python module in the usual spot and it should get picked-up.16:46
OvenWerk1Yes, in /usr/lib but sys.path does not include /usr/local/lib16:47
OvenWerk1I could put the module in {prefix}/bin16:48
OvenWerk1but that is not nice either16:48
OvenWerk1(but it is how I am testing)16:48
EickmeyerMakes sense, but I"m just worried about reproducibility.16:49
OvenWerk1I already detect where we are run from to get install_directory16:50
OvenWerk1 I use that to findout where */share is16:51
OvenWerk1So I can add install_directory/lib/python3/packages (or whatever) to sys.path16:52
OvenWerk1but that would mean:16:53
OvenWerk1import sys16:53
OvenWerk1add runpath/etc to sys.path then import auto_jack16:54
EickmeyerI've seen that line a lot in Python, so I think that'd be safe.16:54
OvenWerk1Eickmeyer: can you show me an example?16:54
EickmeyerI wish I could, but I don't even know where to look, and I have to take my son to school now.16:54
OvenWerk1I would like to use "best practice"16:55
OvenWerk1ok16:55
OvenWerk1(we have no school today)16:55
OvenWerk1it being good friday16:55
OvenWerk1hmm, stackoverflow is working again with no login.17:02
OvenWerk1Eickmeyer: when you get back... I am using:18:03
OvenWerk1install_path = os.path.abspath(f"{sys.path[0]}/..")18:04
OvenWerk1sys.path.insert(1,f"{install_path}/lib/python3/dist-packages")18:04
OvenWerk1import auto_jack18:04
OvenWerk1This works fine in my development directory tree and of course effectively does nothing when packaged  ;) but will also work for someone doing make install into local18:06
OvenWerk1Googling and searching basically shows that no one agrees on a "right" way to do this. But most of the people who don't like this particular method are people who expect packages (in which case I wouldn't need any of this)18:08
EickmeyerOvenWerk1: Yeah, Debian has basically taken the stance of "stay the **** out of /usr/local when packaging".18:19
OvenWerk1I agree. There are still people who like to build/install local stuff in local18:20
OvenWerk1controls is an application outside of packaging too and so has to take these tings into account18:21
OvenWerk1 Then /opt/ is really the old flatpack/snap and as such I can ignore it... so you ew for opt applies equally well to snap and flatpack :P18:24
EickmeyerYeah. /opt/ is a "stay out of" as well.18:25
OvenWerk1I am pretty happy so far as I have a module with one def in it that just prints some text and works as it should so I can move on to populating it something real. I think the first thing is to move the whole of convert into it so convert does not need a system call.18:27
OvenWerk1This has been a theme in the past few updates of controls...18:30

Generated by irclog2html.py 2.7 by Marius Gedminas - find it at mg.pov.lt!