Distributing multiple related scripts

Harry George hgg9140 at seanet.com
Sat Jul 28 12:50:59 CEST 2001


Don Dwiggins <dwig at advancedmp.net> writes:

> I have a distribution need that might be somewhat unusual: instead of
> distributing a single program, I need to distribute a collection of scripts,
> some to be run manually, others scheduled.  Since there's considerable
> common code among them, I want to have one or more common modules that the
> scripts can load as needed.
> 
> Both the source and target of distribution are Windows machines.  Also, it's
> possible to have Python installed on the target machine(s).
> 
> 1) What would be the best distribution tool and setup for this?
> 2) How would the scripts access the common modules?
>

Use the standard "setup.py".  In your development or working dir, do:

  myproject/
     mypackage/
       __init__.py
       mod01.py
       mod02.py
     scripts/
       script01.py
       script02.py
     setup.py

setup.py has:
   ...
   packages=['mypackage'],
   scripts=['scripts/script01.py','script02.py'],
   ...

The scripts of course import the package and use its modules:
   import mypackage
   ...
   mypackage.mod01.do_something()

To distribute:
   python setup.py build
   python setup.py sdist

Copy the resulting tarball to the installation location and untar.  
Then follow the std process:
   python setup.py build
   python setup.py install  <-- maybe as root
 
If you need some help writing a setup.py, you ca see 
my "mkpythonproj" at:
  http://www.seanet.com/~hgg9140/comp/index.html

> Thanks for any good words,
> 
> -- 
> Don Dwiggins                    "Solvitur Ambulando"
> Advanced MP Technology
> dwig at advancedmp.net
> 
> 

-- 
Harry George
hgg9140 at seanet.com



More information about the Python-list mailing list