What is a branch?

Marcin Kasperski Marcin.Kasperski at softax.com.pl
Fri Feb 15 11:27:38 CST 2008


> Except that this makes it more cumbersome to develop in a language
> like Python where you need to have your clone in PYTHONPATH (or at
> least that is how I do it -- I would love if anybody could tell me how
> to easily switch from one clone to another and still have the correct
> clone in my PYTHONPATH. Perhaps one could use a little extension that
> updates a symlink to point to the correct clone...).

Why do you need symlink? Having grown on perl's FindBin::Bin I feel
that sth like

   import sys, os.path
   dir = os.path.join(os.path.abspath(os.path.dirname(sys.argv[0])),'modules')
   sys.path.append(dir)

is not that bad. You detect the correct path relatively to the
location of the script you start (the example above adds subdir
modules below the main script).

This works equally well for

   python main_script.py
   python some/dir/main_script.py
   python /whole/path/to/main_script.py

If your script does not chdir, feel free to drop os.path.abspath



-- 
----------------------------------------------------------------------
| Marcin Kasperski   | If we are to be successful, we must still have
| http://mekk.waw.pl |    the courage to put our faith in people as
|                    |  opposed to a process. (Booch,Martin,Newkirk)
----------------------------------------------------------------------



More information about the Mercurial mailing list