can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant
Hello all,
Right now I am a bit confused on a final stage of my project.

I need to create an installer and an executable file for my python
program for gnu/linux.

The install script has to put the package into site-packages folder
where all other libraries reside.  Then put the executable file
into /usr/bin as other files.

The installer must also do the basic task of creating the database and
setting up password for on postgresql.
now here comes the main problem.
I believe putting files into proper places is pritty easy (may be some
one will instantly reply to the issue of putting the executable file and
libraries in place ).  But to do the database based activities, I need
python-psycopg2 module for postgresql in the first place.  So is it
possible for python to self download and install all the necessary
modules on to the client machine?

What further complicates the system is the fact that I want in future to
create 2 deb files, one for installing the gtk based client application
and the other to install the server side app made in python-twisted for
rpc.  Now the obvious problem is that first my python installation
(either 2.5 or 2.4) must check for itself if the modules are present or
not and if they are not present, my install utility must either download
it from net or if that's not the recommended approach then compile the
module from the source.

how do I achieve all this in python?
I know bash could be used to do such things but I don't want to use bash
because it is to clunky and won't run easily on windows.
Moreover I want to create a deb file as I said before so I want to keep
it as simple as possible.

Even regarding the executable, I am confused on using bash as the script
for writing the executable which can then do some thing like python -c
and call the modules, or write this executable code in a main.py and put
that file into the executable path i.e /usr/bin.

Please clear this mater so that I can go ahead.

I know the python list is pritty busy and I must thank all the members
who keep the spirit of the community and the professional organisations
alive so may be I will get a solution to my problem soon.

happy hacking.
Krishnakant.


  







--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread News123
Hi,

I think you got lost in the wrong thread.
Though your subject line is correct your post threads under Is there a
programming language, that . . . 

Perhaps you 'replied' to above thread and changed 'just' the subject line.

Chances to get an answer might be higher if you repost your question
without replying to an existing thread.



Krishnakant wrote:
 Hello all,
 Right now I am a bit confused on a final stage of my project.
 
 I need to create an installer and an executable file for my python
 program for gnu/linux.
 
 The install script has to put the package into site-packages folder
 where all other libraries reside.  Then put the executable file
 into /usr/bin as other files.
 
 The installer must also do the basic task of creating the database and
 setting up password for on postgresql.
 now here comes the main problem.
 I believe putting files into proper places is pritty easy (may be some
 one will instantly reply to the issue of putting the executable file and
 libraries in place ).  But to do the database based activities, I need
 python-psycopg2 module for postgresql in the first place.  So is it
 possible for python to self download and install all the necessary
 modules on to the client machine?
 
 What further complicates the system is the fact that I want in future to
 create 2 deb files, one for installing the gtk based client application
 and the other to install the server side app made in python-twisted for
 rpc.  Now the obvious problem is that first my python installation
 (either 2.5 or 2.4) must check for itself if the modules are present or
 not and if they are not present, my install utility must either download
 it from net or if that's not the recommended approach then compile the
 module from the source.
 
 how do I achieve all this in python?
 I know bash could be used to do such things but I don't want to use bash
 because it is to clunky and won't run easily on windows.
 Moreover I want to create a deb file as I said before so I want to keep
 it as simple as possible.
 
 Even regarding the executable, I am confused on using bash as the script
 for writing the executable which can then do some thing like python -c
 and call the modules, or write this executable code in a main.py and put
 that file into the executable path i.e /usr/bin.
 
 Please clear this mater so that I can go ahead.
 
 I know the python list is pritty busy and I must thank all the members
 who keep the spirit of the community and the professional organisations
 alive so may be I will get a solution to my problem soon.
 
 happy hacking.
 Krishnakant.
 
 
   
 
 
 
 
 
 
 
--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant

sorry, but I was not replying to another thread.

My mistake.

happy hacking.
Krishnakant.



--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant
hi very sorry for that 

On Sun, 2009-04-19 at 14:50 +0200, News123 wrote:
 Hi,
 
 I think you got lost in the wrong thread.
 Though your subject line is correct your post threads under Is there a
 programming language, that . . . 
 
 Perhaps you 'replied' to above thread and changed 'just' the subject line.
 
 Chances to get an answer might be higher if you repost your question
 without replying to an existing thread.
 I did not mean to do so, may be just missed out on removing the lines of the 
 previous thread.

sorry again.
I hope this becomes a new thread now and I get some productive reply.
happy hacking.
Krishnakant.




--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Chris Jones
On Sun, Apr 19, 2009 at 09:55:08AM EDT, Krishnakant wrote:
 hi very sorry for that 
 
 On Sun, 2009-04-19 at 14:50 +0200, News123 wrote:
  Hi,
  
  I think you got lost in the wrong thread.
  Though your subject line is correct your post threads under Is there a
  programming language, that . . . 
  
  Perhaps you 'replied' to above thread and changed 'just' the subject line.
  
  Chances to get an answer might be higher if you repost your question
  without replying to an existing thread.
  I did not mean to do so, may be just missed out on removing the lines of 
  the previous thread.
 
 sorry again.
 I hope this becomes a new thread now and I get some productive reply.
 happy hacking.
 Krishnakant.

No big deal, mature mailers such as mutt let you break threads into
subthreads via a painless Alt-B.

CJ
--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Gabriel Genellina
En Sun, 19 Apr 2009 08:16:15 -0300, Krishnakant hackin...@gmail.com  
escribió:



I need to create an installer and an executable file for my python
program for gnu/linux.

The install script has to put the package into site-packages folder
where all other libraries reside.  Then put the executable file
into /usr/bin as other files.


Write a setup.py script using the distutils package:
http://docs.python.org/distutils/index.html


I believe putting files into proper places is pritty easy (may be some
one will instantly reply to the issue of putting the executable file and
libraries in place ).  But to do the database based activities, I need
python-psycopg2 module for postgresql in the first place.  So is it
possible for python to self download and install all the necessary
modules on to the client machine?


You said you want to create a .deb -- list the required dependencies there.


Even regarding the executable, I am confused on using bash as the script
for writing the executable which can then do some thing like python -c
and call the modules, or write this executable code in a main.py and put
that file into the executable path i.e /usr/bin.


I've seen both a bash script with a single line: python path/to/main.py,  
and a Python script that just imports some modules and then calls the main  
function. Perhaps bash is more useful if your program (or any library)  
requires some environment variables to be set.


--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Krishnakant
On Sun, 2009-04-19 at 14:55 -0300, Gabriel Genellina wrote:

 Write a setup.py script using the distutils package:
 http://docs.python.org/distutils/index.html
 
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?

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.

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?

happy hacking.
Krishnakant.
 


--
http://mail.python.org/mailman/listinfo/python-list


Re: can python access OS level features like bash scripting?

2009-04-19 Thread Gabriel Genellina
En Sun, 19 Apr 2009 18:40:58 -0300, Krishnakant hackin...@gmail.com  
escribió:



On Sun, 2009-04-19 at 14:55 -0300, Gabriel Genellina wrote:


Write a setup.py script using the distutils package:
http://docs.python.org/distutils/index.html


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.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list