Open alexwlchan opened 7 years ago
I reckon that Loris's setup.py could use a bit of an overhaul. The way it installs most of its files is horrifying.
Running "pip install loris" would be nice.
I'm working on creating Debian packages for Loris and it would be pretty easy to do if setup.py's run() function didn't install things directly to the file system.
@alexwlchan @minusdavid any thoughts on how to address setup.py writing directories to the filesystem? I would like to be able to do a "python setup.py install" without being the loris user. Here are some possibilities I see:
Thoughts?
Here's an example that lets you echo the conf file (and cat to a file if you want): https://github.com/Supervisor/supervisor/blob/master/setup.py#L91
I have a Draft PR #449, for splitting up the package install and the initialization commands. setup.py would handle the code install, and then the commands would be available for the user to run if desired. Feel free to leave feedback.
It's been a while since I've done much with Loris, and I'm not a Python expert nor am I a PyPI expert, so I'm probably not the best person to ask.
I'm mostly familiar with creating Debian packages and RPM packages for Koha, which uses a Makefile generated by Makefile.PL.
You can read more about how Debian packages are created from Koha source code at the following: http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=debian/rules;h=20eb9e207f42d8a61d36861c6f3a2994a330e626;hb=HEAD https://manpages.debian.org/jessie/debhelper/dh_auto_install.1.en.html
I don't have my RPM specfile on hand, so I can't remember how I make Koha install relative to a BUILDROOT instead of onto the root file system.
Looking at the following, it looks like you can specify a prefix and (maybe) a root directory...
https://stackoverflow.com/questions/4740473/setup-py-examples https://docs.python.org/2/install/#how-installation-works https://docs.python.org/2/install/#alternate-installation-unix-the-prefix-scheme
This is kind of interesting regarding Python and packages... https://docs.python.org/3/distutils/builtdist.html
I'm guessing though that setup.py runs into the same problems as Makefile does... and that's that it expects to be installing into "lib" or "bin" folders rather than deploying a complex web application. With Koha, I think we twist the Makefile to do what we want...
You can see the Koha Makefile.PL (the Perl equivalent of a Python setup.py I suppose) at http://git.koha-community.org/gitweb/?p=koha.git;a=blob;f=Makefile.PL;h=ce323ef163a50db1162f3ef08354e885e8f07628;hb=HEAD. Pay close attention to INSTALL_BASE
Going to look at that PR now...
Right now, I’m installing Loris by downloading the ZIP release bundle from GitHub, unpacking it and running
python setup.py install
. It would be nice if Loris could be installed from PyPI instead:It’s a small thing, but it would make my deployments a little simpler. 🙂