On Thu, Jul 26, 2012 at 3:41 PM, Robert Park <ro...@gottengeography.ca> wrote:
> I'm currently working on unifying as much as possible the 'master' and
> 'debian' branches, in the hopes that indeed there can be no patches
> and you can just drop the 'debian/' folder into the upstream tarball
> and build a package.

Ok, so I mostly have succeeded in this unification, but there is one
point where I'm not sure if the solution I've come up with is the best
one or not.

In my setup.py, it's necessary to do some things slightly differently
depending on whether a .deb is being built, or if the program is being
installed directly to the system (by a user). For example, if a user
downloads git master and runs 'sudo ./setup.py install', it is
necessary for the setup.py script to call 'glib-compile-schemas' at
the end, otherwise the program will crash on launch. But calling
glib-compile-schemas isn't necessary to build a .deb, since debian is
smart enough to call glib-compile-schemas on it's own after the .deb
has been installed.

Previously, my solution was to just unconditionally run
glib-compile-schemas from within setup.py in the git master branch,
and then maintained a separate 'debian' branch that cut that part out
of the setup.py. Now what I've done is written a test into the
setup.py so that it only runs glib-compile-schemas if setup.py is
being called by a user, not by debhelper.

My question is, what would be the best way to test, from within
setup.py, whether or not setup.py is being called by a user or by
debhelper? The test that I came up with was to see whether or not the
commandline option '--root' was specified, assuming that if --root is
present, then we must have been called by debhelper and thus calling
glib-compile-schemas is pointless, but if --root wasn't specified,
then we're installing to the system and glib-compile-schemas will be
necessary for the program to run.

This is what I'm talking about if you're curious:

https://github.com/robru/gottengeography/commit/2b7573b23722440a645ee6600fcfe14d0fa2ea51

It seems like a reasonable test to me, but I'm just wondering if maybe
there's a better or more common approach to this problem.

Thanks again!

-- 
http://gottengeography.ca

-- 
Ubuntu-motu mailing list
Ubuntu-motu@lists.ubuntu.com
Modify settings or unsubscribe at: 
https://lists.ubuntu.com/mailman/listinfo/ubuntu-motu

Reply via email to