473,386 Members | 1,630 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

setup.py - just what is it for ?

Hi - This is probably quite a stupid question but I've never
understood what setup.py does. I've got a situation at the moment
where I would like to use a script (which someone else has written and
made available) to do CGI on a shared webserver to which I do not have
shell access.

The install instructions say "run python setup.py" but as far as I'm
aware I cannot do that.

There is only one script involved (except for the setup.py !) and so
I'm probably just going to copy it into my cgi-bin and give it a go
but I'd like to know for future reference just how bad could it be if
I did this ? Are there circumstances where you must use setup.py to
have any hope of the code working ?

BTW here is the setup.py in question ...

from distutils.core import setup

classifiers = """\
Development Status :: 5 - Production/Stable
Environment :: Web Environment
Intended Audience :: Developers
License :: OSI Approved :: GNU General Public License (GPL)
Operating System :: OS Independent
Topic :: Internet :: WWW/HTTP
Topic :: Internet :: WWW/HTTP :: Dynamic Content :: CGI
Tools/Libraries
"""
import sys
if sys.version_info < (2, 3):
_setup = setup
def setup(**kwargs):
if kwargs.has_key("classifiers"):
del kwargs["classifiers"]
_setup(**kwargs)

setup(name="cgi_app",py_modules=["cgi_app"],
version="1.3",
maintainer="Anders Pearson",
maintainer_email="an****@columbia.edu",
url = "http://thraxil.org/code/cgi_app/",
license = "http://www.gnu.org/licenses/gpl.html",
platforms = ["any"],
description = "CGI and mod_python MVC application framework",
long_description = """framework for building MVC CGI and
mod_python
applications. based on the perl CGI::Application module but
more
pythonic.""",
classifiers = filter(None, classifiers.split("\n")))
.... I would appreciate any information about this (or any tips on how
to deal with no shell access).

thanks

richard
Jul 18 '05 #1
4 2161
Richard Shea wrote:
Hi - This is probably quite a stupid question but I've never
understood what setup.py does. I've got a situation at the moment
where I would like to use a script (which someone else has written and
made available) to do CGI on a shared webserver to which I do not have
shell access.

The install instructions say "run python setup.py" but as far as I'm
aware I cannot do that.
http://www.python.org/doc/current/inst/
There is only one script involved (except for the setup.py !) and so < I'm probably just going to copy it into my cgi-bin and give it a go but I'd like to know for future reference just how bad could it be if
I did this ? Are there circumstances where you must use setup.py to
have any hope of the code working ?


depends on the package, of course. e.g. a package that includes C extensions
won't work if you don't compile the C extensions...

</F>

Jul 18 '05 #2
You could *try* writing a cgi which did something like
os.spawnv('python', ['setup.py', 'install']) (or whatever would be
right without looking up the docs)...

You sometimes don't need admin rights to run setup.py

I would be interested in the results.

Regards,

Fuzzy
http://www.voidspace.org.uk/atlantib...thonutils.html

Jul 18 '05 #3
You could *try* writing a cgi which did something like
os.spawnv('python', ['setup.py', 'install']) (or whatever would be
right without looking up the docs)...

You sometimes don't need admin rights to run setup.py

I would be interested in the results.

Regards,

Fuzzy
http://www.voidspace.org.uk/atlantib...thonutils.html

Jul 18 '05 #4
OK thanks for the idea. I have tried this with rather strange restults.
First, in order to be sure I knew what was going on, I wrote a script,
SpawnvTestTarget0.py, which didn't do much apart from write to a file.

I then wrote another script which spawnv'd SpawnvTestTarget0.py from
within the CGI context.

This all worked fine. At this point I thought things were looking
pretty good.

I then added in a spawnv to the setup.py (ie the script I really wanted
to be able to run) but as soon as I tried that I got an 'Internal
Server Error' message.

I've also noticed that in the directions for installing it *does* say
that you should run setup.py as root which is probably at least
contributing to the problem. Anyway out of interest here is my script
....
#!/usr/bin/python2.2
"""
A script to try to run an install.py
on a webserver to which I do not have
shell access

Usage: /installshell.cgi
"""

import cgitb; cgitb.enable()
import sys, os, cgi, pickle
from Cookie import SimpleCookie
def print_headers(headers):
for k, v in headers.items():
sys.stdout.write('%s: %s\n' % (k, v))
sys.stdout.write('\n')

print_headers({'Content-type':'text/html'})

sys.stdout.write('<html><body>')
sys.stdout.write('About to execute SPAWNV Command - 1<BR>')
os.spawnv(os.P_WAIT,'/usr/bin/python2.2',['python','setup.py','install'])
os.spawnv(os.P_WAIT,'/usr/bin/python2.2',['python','SpawnvTestTarget0.py','install'])
sys.stdout.write('Finished in execute of SPAWNV Command')
sys.stdout.write('</body></html>')

.... I've got to go to bed now but later I'm going to try just using the
script as it is - I strongly suspect the setup.py in this case is icing
rather than cake ... then again I may be demonstrating my ignorance !
thanks for your help

Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Holger Joukl | last post by:
Hi there, 2 questions regarding build/installation issues: 1. In the python 2.3.3 setup.py script, the detect_modules method of class PyBuildExt contains the following code: 253 if...
2
by: MENTAT | last post by:
Hi, I am trying to create an installer for my web application. So I added a web setup project to my solution (I am using VS.NET 2003). Been playing around with it since then and it basically...
4
by: Nick | last post by:
Hi, I have a windows application, wherein the solution consists of 5 projects. When I try to create a setup and deployment project for this solution, I'm somehow unable to add anything in...
3
by: Gidi | last post by:
hello, i'm writing a windows application in c# and i have few questions: 1. where can i read or see examples about printing documents which i'll create in my forms. i want to print tables and...
4
by: Howard Kaikow | last post by:
When I build a setup project, the dependency in the setup project is tied to the version in which it was built. Is there a way to build a setup project that can be used in both versions of the...
2
by: Ricky | last post by:
I am doing setup and deployment for the first time in .NET. I have developed an application in VB.NET which uses a third party component. But in order for the component to work I need to register...
2
by: A.Carter | last post by:
I am developing a windows application with Visual Studio 2003 using C#. The application is complete so naturally I went to create a setup package. I added a setup project to the solution and I went...
0
by: sheridans | last post by:
I have setup a Web Setup Project to my Solution by going to Add New Project => Setup and Deployment => Web Setup Project. Everything builds correctly and I get a working Setup.exe and .msi file. ...
6
by: Srini | last post by:
Hi, I am facing a problem in localizing the setup file and .NET framework redistributable. I am trying to deploy c# winform application. I have created a setup project. I need to...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.