tools to install not in python tree?

M.-A. Lemburg mal at egenix.com
Tue Mar 4 05:41:16 EST 2008


On 2008-03-04 02:55, commander_coder at 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.egenix.com/products/python/mxBase/

-- 
Marc-Andre Lemburg
eGenix.com

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

:::: 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



More information about the Python-list mailing list