On Tue, Apr 14, 2009 at 6:04 PM, Mads Kiilerich <[email protected]> wrote:
> # HG changeset patch
> # User Mads Kiilerich <[email protected]>
> # Date 1239750286 -7200
> # Node ID 200bc69bd39cd74927d3ec1cb61ba45a7b06ebe7
> # Parent  c6d3fe0afabcf6e9c7fc9a3666e74a4efbb37b19
> RFC: Cleanup/destruction of resource paths
>
> Steve said on http://bitbucket.org/tortoisehg/stable/issue/144 :
>
>  I would be ok with a patch for nautilus-thg.py that removes the environment
>  variable and hard-coded path hacks since the symlink method works better than
>  both of them, and we want the installed path to be the default.
>
>  For the path problems (icons, COPYING.txt), my thought was for packagers to 
> add
>  paths.py into the hggtk package with path functions for all of these things
>  which get scattered about. shlib.py and about.py would look for this file
>  first, then fall back to their original search methods.
>
> I gave it a try and ended up with this, mostly removing and rewriting the old
> search methods.
>
> Tested on linux running from source and from installed rpm.
>
> It has _not_ been tested on windows. I have probably removed some essential
> hacks and workarounds which must be added again somehow. But which hacks were
> essential and which were cruft?
>
> How to continue from here? Can some parts of this patch be used? Which? Could
> the code needed for windows be added on top of this? Could the code
> specific for frozen windows packages be written to the paths.pys?

The approach I would like to end up with has three tiers:

1) In a clean checkout / tarball, the default paths should all just work
2) For frozen builds, there should be special case code that uses relative paths
3) Everyone else should supply a paths file generated by their build scripts

So we end up with pseudo-code like this:

icon_path = '../icons' # relative path from this source module
if hasattr(sys, "frozen"):
   icon_path = os.path.join(os.path.dirname(sys.executable), 'icons')
try:
   import __paths__
   icon_path = __paths__.get_icon_path()
except ImportError:
   pass

Having all this logic in one place so it's only done once is a bonus, and
symlinks to hgtk and nautilus-thg.py should just work without touching
the source code.

I would prefer the paths file to use functions, just in case a packager
needs to include search logic in there.

--
Steve Borho

------------------------------------------------------------------------------
This SF.net email is sponsored by:
High Quality Requirements in a Collaborative Environment.
Download a free trial of Rational Requirements Composer Now!
http://p.sf.net/sfu/www-ibm-com
_______________________________________________
Tortoisehg-develop mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/tortoisehg-develop

Reply via email to