[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.python

tools to install not in python tree?

commander_coder

3/4/2008 1:56:00 AM

Hello,

I have some materials for a project that I am working on that I keep
in a source code control system (svn now, but I'm experimenting with
mercurial). I want to install these things from the repository, but
not into site-packages/ as Distutils wants to do.

For instance there are some administrative scripts I want to put in ~/
admin/ and some programs that I want in ~/public_html/ . I also
want to run some post-install routines (for instance, reset the
database tables on my development machine). So I'm looking for a tool
to take things from a repository and install them into place.
Something like:
install_from_repository.py -version "1.2.7"
if there is a bug in 1.2.7 that I need to work on.

Some of the things that I am looking for are like what setup.py does
(for instance, changing the #! line on scripts or having a
convenient .cfg file). But as I understand it setup only targets
installing below sys.prefix; is that right?

I can write routines for myself but other people must need to do these
things also and a tested solution is obviously better. Is there such
a tool?

Thanks for any help,
Jim
4 Answers

Miki

3/4/2008 4:28:00 AM

0

Hello Jim,

> I have some materials for a project that I am working on that I keep
> in a source code control system (svn now, but I'm experimenting with
> mercurial).  I want to install these things from the repository, but
> not into site-packages/ as Distutils wants to do.
>
> For instance there are some administrative scripts I want to put in ~/
> admin/  and some programs that I want in ~/public_html/ .   I also
> want to run some post-install routines (for instance, reset the
> database tables on my development machine).  So I'm looking for a tool
> to take things from a repository and install them into place.
> Something like:
>   install_from_repository.py -version "1.2.7"
> if there is a bug in 1.2.7 that I need to work on.
>
> Some of the things that I am looking for are like what setup.py does
> (for instance, changing the #! line on scripts or having a
> convenient .cfg file).  But as I understand it setup only targets
> installing below sys.prefix; is that right?
>
> I can write routines for myself but other people must need to do these
> things also and a tested solution is obviously better.  Is there such
> a tool?
Have a look at http://docs.python.org/lib/module-dist...,
specially http://docs.python.org/dist/n... and
http://docs.python.org/inst/alt-install-wi...

HTH,
--
Miki <miki.tebeka@gmail.com>
http://pythonwise.bl...

Diez B. Roggisch

3/4/2008 10:29:00 AM

0

commander_coder@hotmail.com wrote:

> Hello,
>
> I have some materials for a project that I am working on that I keep
> in a source code control system (svn now, but I'm experimenting with
> mercurial). I want to install these things from the repository, but
> not into site-packages/ as Distutils wants to do.
>
> For instance there are some administrative scripts I want to put in ~/
> admin/ and some programs that I want in ~/public_html/ . I also
> want to run some post-install routines (for instance, reset the
> database tables on my development machine). So I'm looking for a tool
> to take things from a repository and install them into place.
> Something like:
> install_from_repository.py -version "1.2.7"
> if there is a bug in 1.2.7 that I need to work on.
>
> Some of the things that I am looking for are like what setup.py does
> (for instance, changing the #! line on scripts or having a
> convenient .cfg file). But as I understand it setup only targets
> installing below sys.prefix; is that right?

You can use setuptools. And it will install to any path available on
sys.path. So if you define PYTHONPATH pointing to some folder, you can use
setuptools to install the code (eggs) as well as create script
entry-points, so if the same path is part of PATH they will become
available on the command line.

Diez

M.-A. Lemburg

3/4/2008 10:41:00 AM

0

On 2008-03-04 02:55, commander_coder@hotmail.com wrote:
> Hello,
>
> I have some materials for a project that I am working on that I keep
> in a source code control system (svn now, but I'm experimenting with
> mercurial). I want to install these things from the repository, but
> not into site-packages/ as Distutils wants to do.
>
> For instance there are some administrative scripts I want to put in ~/
> admin/ and some programs that I want in ~/public_html/ . I also
> want to run some post-install routines (for instance, reset the
> database tables on my development machine). So I'm looking for a tool
> to take things from a repository and install them into place.
> Something like:
> install_from_repository.py -version "1.2.7"
> if there is a bug in 1.2.7 that I need to work on.
>
> Some of the things that I am looking for are like what setup.py does
> (for instance, changing the #! line on scripts or having a
> convenient .cfg file). But as I understand it setup only targets
> installing below sys.prefix; is that right?

The distutils "install" command provides a lot of what you're looking for,
in particular, it makes it easy to install the various parts of
a package in different directories:

$ python2.5 setup.py install --help
Common commands: (see '--help-commands' for more)

setup.py build will build the package underneath 'build/'
setup.py install will install the package

Global options:
--verbose (-v) run verbosely (default)
--quiet (-q) run quietly (turns verbosity off)
--dry-run (-n) don't actually do anything
--help (-h) show detailed help message
--set-version override the package version number

Options for 'mx_install' command:
--prefix installation prefix
--exec-prefix (Unix only) prefix for platform-specific files
--home (Unix only) home directory to install under
--install-base base installation directory (instead of --prefix or --
home)
--install-platbase base installation directory for platform-specific files
(instead of --exec-prefix or --home)
--root install everything relative to this alternate root
directory
--install-purelib installation directory for pure Python module
distributions
--install-platlib installation directory for non-pure module distributions
--install-lib installation directory for all module distributions
(overrides --install-purelib and --install-platlib)
--install-headers installation directory for C/C++ headers
--install-scripts installation directory for Python scripts
--install-data installation directory for data files
--compile (-c) compile .py to .pyc [default]
--no-compile don't compile .py files
--optimize (-O) also compile with optimization: -O1 for "python -O", -O2
for "python -OO", and -O0 to disable [default: -O0]
--force (-f) force installation (overwrite any existing files)
--skip-build skip rebuilding everything (for testing/debugging)
--record filename in which to record list of installed files

usage: setup.py [global_opts] cmd1 [cmd1_opts] [cmd2 [cmd2_opts] ...]
or: setup.py --help [cmd1 cmd2 ...]
or: setup.py --help-commands
or: setup.py cmd --help

> I can write routines for myself but other people must need to do these
> things also and a tested solution is obviously better. Is there such
> a tool?

Things that the stock distutils cannot do out of the box can
easily be added by subclassing commands or adding new ones
in your setup.py.

For some examples how this can be done, have a look at e.g.
the mxSetup.py module we ship with the eGenix mx Base Distribution:

http://www.e...products/pyth...

--
Marc-Andre Lemburg
eGenix.com

Professional Python Services directly from the Source (#1, Mar 04 2008)
>>> Python/Zope Consulting and Support ... http://www.e...
>>> mxODBC.Zope.Database.Adapter ... http://zope.e...
>>> mxODBC, mxDateTime, mxTextTools ... http://python.e...
________________________________________________________________________

:::: Try mxODBC.Zope.DA for Windows,Linux,Solaris,MacOSX for free ! ::::


eGenix.com Software, Skills and Services GmbH Pastor-Loeh-Str.48
D-40764 Langenfeld, Germany. CEO Dipl.-Math. Marc-Andre Lemburg
Registered at Amtsgericht Duesseldorf: HRB 46611

commander_coder

3/4/2008 11:27:00 AM

0

Thank you for the helpful replies. I shall check out the links. (I
looked at some setup.py's but mxBase was not among them.)

Regards,
Jim