On Fri, 2016-09-02 at 08:09 +0000, philip.chime...@gmail.com wrote:
> On Thu, Sep 1, 2016 at 5:43 AM Michael Catanzaro <mcatanz...@gnome.or
> g> wrote:
> > On Tue, 2016-08-30 at 21:25 +0000, philip.chime...@gmail.com wrote:
> > > I've been thinking about the exact same thing recently; how about
> > a
> > > 'jhbuild jump' command that will take you from a location under
> > > srcdir to
> > > the corresponding location under builddir and vice versa? And
> > perhaps
> > > have
> > > some environment variables defined as well.
> > 
> > It could run 'jhbuild shell' if UNDER_JHBUILD is unset, then do the
> > jump. That would be useful.
> 
> I soon ran into the should-have-been-obvious-in-hindsight limitation
> that you can't change the parent process's working directory from a
> jhbuild command.

In the python world we have `pew`, which allows to maintain
effortlessly your virtual environments. Virtual environments are like
the Python equivalent of the jhbuild shell.

One thing that is amazing with pew is that it provides a 

    $ pew workon $project

command which both activates the virtualenv **and** move you to the
source directory of the project you asked to work on.

Which sounds similar to what you'd like for `jhbuild jump` (except that
would place you into the builddir, not the scrdir).

The way pew does that it simply runs a new shell in the right working
directory.

Couldn't `jhbuild jump` do the same?

In python that's as simple as:

    $ python3
    Python 3.5.1 (default, Aug  9 2016, 15:35:51) 
    [GCC 6.1.1 20160621 (Red Hat 6.1.1-3)] on linux
    Type "help", "copyright", "credits" or "license" for more information.
    >>> import os
    >>> import subprocess
    >>> 
    >>> os.getcwd()
    '/home/mathieu'
    >>> 
    >>> subprocess.check_call(['bash'], cwd='/tmp')
    $ pwd
    /tmp
    $ exit
    0
    >>> 


-- 
Mathieu
_______________________________________________
desktop-devel-list mailing list
desktop-devel-list@gnome.org
https://mail.gnome.org/mailman/listinfo/desktop-devel-list

Reply via email to