473,686 Members | 3,266 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

A tool for Python - request for some advice

TPJ
First I have to admit that my English isn't good enough. I'm still
studying and sometimes I just can't express what I want to express.
A few weeks ago I've written 'Python Builder' - a bash script that
allows anyone to download, compile (with flags given by user) and
install Python and some external modules (e.g. wxPython, PyGTK,
Numeric...). I use Python every day and when new version of Python (or
some external module) is released, I want to check if my projects will
run on this new version (sometimes I want to know if my projects will
run on specific combination of older Python and some older external
modules...). It happens four - five times a year. Frequently not enough
to memorize all commands used to configure, compile and install all of
this software (so I have to read documentation every time I'm doing it)
- but frequently enough to consume considerable amounts of my working
time. So I thought that writing a script to do it all automatically
(download sources, unpack them, configure them, compile them and then
install them; all of this with options given by me - the user) would be
a good idea.

(It's not about using emerge, get-apt or some another tool of this
kind. My need is very special - I want to have Python, it's modules and
sometimes documentation installed in particular place; usually
somewhere in my home directory. My script installs some additional
scripts which I can use to run Python. These additional scripts have
properly set LD_LIBRARY_PATH so they are able to run Python and
external modules that require libraries installed in non-standard
locations.)

I've written this script in bash, because I thought it would be better
to have a script which would run in environment without Python (it all
was about installing Python anyway!). I used bash, dialog, wget... And
now someone suggested, that I shuld use Python. That using Python would
lead to clearer and - probably - smaller code. (I have to admit it - my
code in bash is just messy.)

And now I'm considering this idea. Python is already present on
(almost?) every distribution today, so why worry about it's presence?
Writing in Python would lead to easier i18n (for now it's all in
Polish...) and to easier implementation of future enhancements (due to
language's features and much more clearer coding style in Python). Well
- I've already found it hard to implement new features in pure bash.

But, on the other hand, I'm thinking that writing in bash is more
universal solution. I mean that requirements to run bash scripts are
lower than requirements to run Python scripts. Could this requirements
be decisive for some users (or is it only my imagination)? Sometimes
users just have no access to Python (e.g. LFS, some stages of Gentoo,
some rescue and specialized distros).
And there's also something more. For now "Python Builder" works in text
mode. It was written in bash and I assumed it should be some kind of
"basic" tool - so text mode and bash seemed to be the best choice. But
if I rewrote all code in Python I could make some GUI. It could works
even better - I could easily check if GUI mode is available and run in
proper (GUI or text) mode. But is GUI needed by people who just want it
to do it's job and quit?
Well, what do you think?

Jul 19 '05 #1
9 2075
TPJ said unto the world upon 21/06/2005 02:00:
First I have to admit that my English isn't good enough. I'm still
studying and sometimes I just can't express what I want to express.

I've graded essays in Philosophy at my university that were written by
native speakers of English yet were substantially less clear and well
written than your post. I don't think you will need to lead with an
apology for your language skills in the future :-)

A few weeks ago I've written 'Python Builder' - a bash script that
allows anyone to download, compile (with flags given by user) and
install Python and some external modules (e.g. wxPython, PyGTK,
<snip>
kind. My need is very special - I want to have Python, it's modules and
sometimes documentation installed in particular place; usually
somewhere in my home directory. My script installs some additional
<snip>
I've written this script in bash, because I thought it would be better
to have a script which would run in environment without Python (it all
was about installing Python anyway!). I used bash, dialog, wget... And
now someone suggested, that I shuld use Python. That using Python would
lead to clearer and - probably - smaller code. (I have to admit it - my
code in bash is just messy.)

And now I'm considering this idea. Python is already present on
(almost?) every distribution today, so why worry about it's presence?
<snip>
But, on the other hand, I'm thinking that writing in bash is more
universal solution. I mean that requirements to run bash scripts are
lower than requirements to run Python scripts. Could this requirements
be decisive for some users (or is it only my imagination)? Sometimes
users just have no access to Python (e.g. LFS, some stages of Gentoo,
some rescue and specialized distros).
<snip>
Well, what do you think?


I'm not a sophisticated programmer (I wouldn't know a bash script if
it bit me).

So, to make sure I've understood (the issue is my level of knowledge,
not your level of English): you want to provide a specialized install
script for Python (3rd party modules, non-standard locations, etc.)
You started in bash to deal with minority cases without an extant
Python install. But clearly, there will be a Python install by the
time your bash script is done, or something will have gone very wrong.

That suggests implementing the custom installation work in Python, and
having a bash script that will

1) determine if there is an existing Python install,
2) if there is not, install Python in the standard way,
3) using the now guaranteed to be there installation of Python, run
your Python script that does all of your custom installation, and
4) if step (2) added a Python installation other than the one added by
step (3), perhaps remove it.

Am I missing some reason why that wouldn't be a satisfactory option?
(This is entirely possible :-)

Best,

Brian vdB

Jul 19 '05 #2
Brian van den Broek wrote:
That suggests implementing the custom installation work in Python, and
having a bash script that will

1) determine if there is an existing Python install,
2) if there is not, install Python in the standard way,
3) using the now guaranteed to be there installation of Python, run
your Python script that does all of your custom installation, and
4) if step (2) added a Python installation other than the one added by
step (3), perhaps remove it.


Allow me to second that advice and also point out some work that should
make step 3 easier in the, hopefully near, future:

http://peak.telecommunity.com/DevCenter/EasyInstall

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Jul 19 '05 #3
TPJ schrieb:
First I have to admit that my English isn't good enough. I'm still
studying and sometimes I just can't express what I want to express.


No excuses, please! Keep in mind that your English is much better than
the Polish of most of us. And just in case you were fishing for
compliments:

Your English IS good enough.

;)

--
-------------------------------------------------------------------
Peter Maas, M+R Infosysteme, D-52070 Aachen, Tel +49-241-93878-0
E-mail 'cGV0ZXIubWFhc0 BtcGx1c3IuZGU=\ n'.decode('base 64')
-------------------------------------------------------------------
Jul 19 '05 #4
"TPJ" <tp*****@interi a.pl> writes:
I've written this script in bash, because I thought it would be better
to have a script which would run in environment without Python (it all
was about installing Python anyway!). I used bash, dialog, wget... And
now someone suggested, that I shuld use Python. That using Python would
lead to clearer and - probably - smaller code. (I have to admit it - my
code in bash is just messy.)

And now I'm considering this idea. Python is already present on
(almost?) every distribution today, so why worry about it's presence?
Is your target platform Linux? I've seen the claim that every Linux
distro comes with Python installed, but can't verify it.

On the other hand, not every Unix distribution comes with Python
installed. BSD systems for instance tend to be pretty
minimalist. Solaris isn't minimalist, but you have to get Python from
a third party. This is probably true of other commercial Unix
distributions as well. MacOS X is a known exception - it comes with
Python preinstalled.

Then again, the same comments apply to bash. Distributions that have
their roots in AT&T Unix probably don't come with bash by default,
with Mac OS X being an exception. This makes depending on bash a bad
idea if you want to write a script that portable across Unix distros.

If your target platform is Linux, indications are that python is as
portable as bash. If your target platform is Unix, then the same is
true - except you shouldn't be writing bash if you want
portability. Try reading <URL:
http://www.bsdatwork.com/2004/03/04/...shell_scripts/ for what's involved in writing portable shell scripts.


<mike
--
Mike Meyer <mw*@mired.or g> http://www.mired.org/home/mwm/
Independent WWW/Perforce/FreeBSD/Unix consultant, email for more information.
Jul 19 '05 #5
TPJ
> (...) I've seen the claim that every Linux
distro comes with Python installed, but can't verify it.
So have I. And I think it might be truth. The only problem is that
different distros might be released with different versions of Python.

<snip>
Then again, the same comments apply to bash. Distributions that have
their roots in AT&T Unix probably don't come with bash by default,
with Mac OS X being an exception. This makes depending on bash a bad
idea if you want to write a script that portable across Unix distros.
Good to know. So my script written in bash will be primary targeted for
Linux distros. OK, I can live with that.
If your target platform is Linux, indications are that python is as
portable as bash.
I've thought about it for a few days and I disagree with you. Python
isn't as portable as bash because of one reason. The problem is that
development of Python is much more dynamic than development of bash. If
I wrote my script in Python it would be possible that this script
wouldn't run on the same distro with _different_ version of Python.

(This is problem because someone has sugested that he'd like to run
this script on RH 9. So older distros must be considered as well as
newer.)

As long as I'm using bash, I'll deal with a tool that has the same
features on different distros (well... _almost_ the same features)

(This is about portability, of course. There are also another
advantages of using bash.)
If your target platform is Unix, then the same is true - except you
shouldn't be writing bash if you want portability.


Well, my primary goal is Linux. I'm working on Linux and I have no
access to any *BSD system (or another flavour of Unix). I thought that
bash scripts are portable, but now I can see I was wrong.

Thanks for all your help.

Jul 19 '05 #6
TPJ
<snip>
So, to make sure I've understood (...) : you want to provide
a specialized install script for Python (3rd party modules,
non-standard locations, etc.)
yes
You started in bash to deal with minority cases without an extant
Python install.
My motivation was rather to avoid a bootstrap-like problems. I thought
that writing a script in _Python_ for compiling _Python_ is just silly
idea. I thought that bash (available even in rescue distros!) would be
a better tool.
But clearly, there will be a Python install by the
time your bash script is done, or something will have gone very wrong.
yes
That suggests implementing the custom installation work in Python, and
having a bash script that will


<snip>

Well... not exactly.

My primary goal is to save time spent on downloading, uncompressing,
reading documentation, configuring, compiling and installing software.
So I want to write a tool that would allow me to spent a few minutes to
tell it what to do - and then it would do it all. I would pay attention
to this tool for a few minutes, instead of wasting much more time doing
it all myself.

I could check for a Python installation and install Python in standard
way in case Python wouldn't be available but this would have following
disadvantages:
1) It would be a large waste of time spent on installing Python in
standard way. (Especially if user wouldn't like _standard_ Python
installation. I'm working on this script because in most situations I'm
not happy with such standard installation!)
2) It would lead to download a particular Python's version for a
temporary purpose - and this means additional waste of time and
bandwith.

For now my script works as follows:
1) It allows user to configure all options and actions.
2) When user is ready it just does what it is supposed to do.

The first stage is very important - it takes a few minutes and then all
is done automatically.
Thanks for your advice - it was really helpful.

Jul 19 '05 #7
TPJ
I've heard about this "EasyInstal l" and I like this idea.

If EI becomes a part of Python's standard library, my script will use
it.

Jul 19 '05 #8
TPJ wrote:
I've heard about this "EasyInstal l" and I like this idea.

If EI becomes a part of Python's standard library, my script will use
it.


Why wait? Just make it the second thing that the script installs after
Python itself.

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter

Jul 19 '05 #9
On Friday 24 June 2005 04:04 am, TPJ wrote:
If your target platform is Linux, indications are that python is as
portable as bash.


I've thought about it for a few days and I disagree with you. Python
isn't as portable as bash because of one reason. The problem is that
development of Python is much more dynamic than development of bash. If
I wrote my script in Python it would be possible that this script
wouldn't run on the same distro with _different_ version of Python.

(This is problem because someone has sugested that he'd like to run
this script on RH 9. So older distros must be considered as well as
newer.)


If you write your scripts to work with Python 2.1, they will work on
practically any Linux distribution that is still in wide use on desktops
and servers. You might get into trouble on embedded systems or
"rescue disk" Linuxes (i.e. you might have to go back to 1.5).

--
Terry Hancock ( hancock at anansispacework s.com )
Anansi Spaceworks http://www.anansispaceworks.com

Jul 19 '05 #10

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

Similar topics

12
3029
by: vincent_delft | last post by:
I'm looking for a Web Tool kit to build web pages with the following criteria (in priority order) : - easy to use, develop (reuseability of code, ...) - flexible (ideally should run with Python CGIHTTPServer and/or with Apache (with or wihout mod_python) - possibility to have load balancing and/or caching (for very high loaded web pages) I've founded lot of tools ...
50
5489
by: Edward K. Ream | last post by:
I would like to say a few (actually more than a few) words here about some recent discoveries I have made concerning the interaction of Leo and Python. If you don't want to hear an inventor enthuse about his work, please feel free not to read further :-) There are at least three, no four, no five, no six, no seven reasons why Leo and Python work so well together. Most are new (in my mind) with the 4.1 release of Leo. The first several...
34
3638
by: Erik Johnson | last post by:
This is somewhat a NEWBIE question... My company maintains a small RDBS driven website. We currently generate HTML using PHP. I've hacked a bit in Python, and generally think it is a rather cool language. I've done Perl and like it, there are a few features of PHP I like but overall am not too excited about it. I have found PHP's strtotime() function to be quite flexible and handy and we make liberal use of it. I have not yet really...
3
2829
by: fdsl ysnh | last post by:
--- python-list-request@python.orgдµÀ: > Send Python-list mailing list submissions to > python-list@python.org > > To subscribe or unsubscribe via the World Wide Web, > visit > http://mail.python.org/mailman/listinfo/python-list > or, via email, send a message with subject or body > 'help' to
7
4043
by: vamichael | last post by:
When I try to run the Website Administration Tool from my published application using http://localhost/myapp/webadmin.axd I am getting a "resource not found" error message. I can use the Admin tool from the IDE however. I noticed some people referring to a directory called c:\Inetpub\wwwroot\aspnet_webadmin\, which i do not have on my system.
10
2081
by: Peter | last post by:
This post seeks advice on whether python would be appropriate for a task, or whether you can suggest another approach. The project is to transcribe historical records such as schools admissions, ship passenger lists, birth/death/marriages, etc for genealogy studies. What we need is a simple software tool that will give the user a form set out like the page being transcribed, do some simple validation and put the data in a file (can be...
4
2376
by: Anastasios Hatzis | last post by:
I'm looking for a pattern where different client implementations can use the same commands of some fictive tool ("foo") by accessing some kind of API. Actually I have the need for such pattern for my own tool (http://openswarm.sourceforge.net). I already started restructuring my code to separate the actual command implementations from the command-line scripts (which is optparser-based now) and have some ideas how to proceed. But probably...
7
2457
by: sami | last post by:
Hi I am trying to write a facebook application in python - I have been programming simple desktop applications till now and am not really familiar with web apps Pyfacebook is the wrapper for the REST based Facebook API - there is a simple example for its usage as shown below: def simple_web_app(request, api_key, secret_key):
15
3218
by: kyosohma | last post by:
Hi, I am trying to get a small group of volunteers together to create Windows binaries for any Python extension developer that needs them, much like the package/extension builders who volunteer their time to create Linux RPMs. The main thing I need are people willing to test the binaries to make sure the extension is stable. This would require installing the binary and probably downloading the source too to get the developer's test
0
8584
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8516
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8932
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8768
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8778
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7599
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6440
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4308
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.