← Back to team overview

launchpad-dev team mailing list archive

Finding the right 'bzr' at runtime for 'lp-forking-service'

 

-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

As part of the forking service work, I'm trying to put together the init
script. The current blocker is finding the 'bzr' script itself to run.

As near as I can tell, the path to use is:
  $launchpad/eggs/bzr-2.2.1-py2.6-linux-i686.egg/EGG-INFO/scripts/bzr


The init script I'm cribbing from is using $launchpad/bin/twistd, but
there isn't a matching $launchpad/bin/bzr.

Obviously the above path is brittle, and probably shouldn't be hardcoded.

Codehosting uses this function:

 def get_bzr_path():
    bzr_in_egg_path = os.path.join(
      os.path.dirname(os.path.dirname(bzrlib.__file__)),
        'EGG-INFO/scripts/bzr')
    if os.path.exists(bzr_in_egg_path):
      return bzr_in_egg_path
    else:
      ...

I'm not really sure how to expose that tastefully to a startup script in
/etc/init.d. Would it just be:

LAUNCHPAD_ROOT=...
PYTHON=${LAUNCHPAD_ROOT}/bin/py
BZR_PATH=`$PYTHON -c "from os.path import join, dirname; \
   import bzrlib; \
   print join(dirname(dirname(bzrlib.__file__)), \
    'EGG-INFO/scripts/bzr')"`

It doesn't look particularly pleasing, but maybe this is the best we can
get?

Any help would be appreciated.

John
=:->
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (Cygwin)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAkzsQxQACgkQJdeBCYSNAAN/PACfdxxp+qJTEHTecnmHRgXj8bxE
EPgAoL/cOcEE6riD8QueubXhR0SWt1Z7
=ag0W
-----END PGP SIGNATURE-----



Follow ups