What is a branch?
Martin Geisler
mg at daimi.au.dk
Fri Feb 15 16:26:07 CST 2008
Marcin Kasperski <Marcin.Kasperski at softax.com.pl> writes:
>> 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
I can see that this would work fine for one or a few programs. But I am
developing a library and I have many little programs that test various
parts of it. I could of course put that in each file as a common header.
But I also like to start an interactive session and work with the
library directly. And I use Twisted's Trial to do unit testing -- there
there I specify the Python module on the command line, which Trial then
imports.
So I think the local branches approach would be easiest for me, for that
would allow me to keep PYTHONPATH fixed and not require me to insert the
correct path in sys.path.
--
Martin Geisler
VIFF (Virtual Ideal Functionality Framework) brings easy and efficient
SMPC (Secure Multi-Party Computation) to Python. See: http://viff.dk/.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 188 bytes
Desc: not available
Url : http://selenic.com/pipermail/mercurial/attachments/20080215/734bd979/attachment.pgp
More information about the Mercurial
mailing list