can python access OS level features like bash scripting?
gagsl-py2 at yahoo.com.ar
Mon Apr 20 07:36:53 CEST 2009
En Sun, 19 Apr 2009 18:40:58 -0300, Krishnakant <hackingkk at gmail.com>
> On Sun, 2009-04-19 at 14:55 -0300, Gabriel Genellina wrote:
>> Write a setup.py script using the distutils package:
> So that can distutil do the work of setting up the database and can it
> find for itself if psycopg2 and other related libraries are installed?
> I am going to create a deb file, so is it a good idea to some how have
> the deb rules execute the setup.py file of the distutils?
There are many concerns here:
Database: setup.py can do whatever you want, it's a Python script (it
*uses* Distutils as a library, not the other way around). So you could
create the database there. (Some applications do that on the first run,
when they detect there is none)
Dependencies: If all your dependencies are available as Debian packages,
just let dpkg handle them. You only have to enumerate the required
dependencies in the control file.
rules: the rules file will refer to a Makefile where you map the actions
("build", "install") to the corresponding arguments to setup.py
From the last point, it's better to start writing a setup.py that works --
at least, test building a source distribution. Then, add your special
actions (like creating the initial database). The last step would be to
add the required Debian files to create a .deb
There are several tutorials on making a .deb out of Python programs -
google for them.
> Besides, I will also like to create a single file containing all the
> modules i need as dependencies so even if a user does not have internet,
> we can still install the package on that machine.
Isn't enough to distribute all the required packages?
> So will it be a good idea to let distutils do every thing I had
> described about putting files in the place and having the script copyed
> to /usr/bin etc?
You don't *let* distutils do that, you *use* distutils in order to do that.
More information about the Python-list