By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
443,742 Members | 1,224 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 443,742 IT Pros & Developers. It's quick & easy.

anaconda.real in RH7.1

P: n/a

I'm trying to reinstall RedHat 7.1 Linux on a PC that was disabled when
I tried to upgrade from RH7.1 to RH9. This is presenting lots of unexpected
difficulties. Apart from wanting to keep the old model T in shape, I'm treating
this as a learning experience. Right now, I'm trying to gain more control
over the installation CD. By that I mean, I intend to modify the installation
script and other aspects of the CD and burn a new installation CD. The
installation script starts off as a shell script named anaconda which
then calls a python script named anaconda.real. The former is pretty easy
to understand, but I don't know anything about python. At the moment, I'm
using the book, "Programming Python", by Mark Lutz, as a reference. The
file anaconda.real is about 526 lines long. I've copied out about an eighth
of it into a notebook and am trying to use the book to make sense of what
I have copied. I'm not finding it very helpful. I don't know whether that
is because the script relies on aspects of python that aren't well explained
in the book or because it relies on aspects of RedHat Linux. I thought I
should ask here first about what seem like purely python issues.

The file anaconda.real is invoked with the line
exec /usr/bin/anaconda.real -T "$@"
I don't know what effect the -T "$@" has.

The file anaconda.real begins:

#!/usr/bin/python
signal.signal(signal.SIGINT,signal.SIG_DFL)

There is nothing about signal or signal.signal or the other signal.*
in the book. The file continues:

# For anaconda in test mode
if (os.path.exists('isys'))
sys.path.append('edd')
sys.path.append('libfdisk')
[lots of lines like that]
else:
sys.path.append('/usr/lib/anaconda')
sys.path.append('/usr/lib/anaconda/textw')
sys.path.append('/usr/lib/anaconda/iw')
sys.path.append('/usr/lib/anaconda/installclasses')

Here I'm guessing that the if never happens and the various /usr/lib/anaconda
directories are appended to the PATH environment variable.

Later on, after importing traceback (which is briefly mentioned in the book),
string, isys, iutil, _ from translate, handleException from exception, it
apparently worries about the environment variable ANACONDAARGS and then
executes

try:
(args, extra) = isys.getopt(theargs, 'GTRxtdr:fm:',
['gui','text','reconfig','xmode','test','debug','no fallback',
'method=','rootpath=',...

Anyway, in a nutshell, whenever I see anything specific in the file
anaconda.real, it isn't mentioned in the book and I don't know how to
get more information about it and I don't know how python gets its information
about it.

What do I need to read?
--
Ignorantly,
Allan Adler <ar*@zurich.csail.mit.edu>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
Sep 2 '05 #1
Share this Question
Share on Google+
4 Replies


P: n/a
Allan Adler wrote:
I'm using the book, "Programming Python", by Mark Lutz, as a reference.


No offence to Mark Lutz or O'Reilly but I consider "Programming Python"
one of the worst books I have read (in my case an old first edition).
It overwhelms the beginning programmer ("Learning Python" is probably
better for that), it bores the experienced programmer to death with
introductory details and does not work as a reference book. It is a
nice survey of application areas for python, but the book lacks a clear
goal, purpose and a problem it tries to address. It needs more focus.
It needs to be marketed correctly also. I believe too many people new
to python buy that book and get discouraged about Python, O'Reilly and
programming when they should buy something else instead.

That said what you probably want is "Python in a Nutshell" by O'Reilly
which is a good reference book it has a concise introduction of Python
in the beginning and after that, documentation for the most usefull
libraries out there.

Personally I use the online documentation a lot:

If I know the the name of the module
(for example it starts with sys.zz) I use:
http://www.python.org/doc/2.4.1/modindex.html

If I know what I want but not the name I use:
http://www.python.org/doc/2.4.1/lib/lib.html

Sep 2 '05 #2

P: n/a
pr*******@latinmail.com wrote:
If I know the the name of the module
(for example it starts with sys.zz) I use:
http://www.python.org/doc/2.4.1/modindex.html

If I know what I want but not the name I use:
http://www.python.org/doc/2.4.1/lib/lib.html


I have a Firefox Quick Search installed with keyword: pymod and location:

http://www.python.org/doc/lib/module-%s.html

or on a Windows box where I have the docs installed locally:

file:///C:/Documentation/Python-Docs-2.4/lib/module-%s.html
--
Michael Hoffman
Sep 2 '05 #3

P: n/a
Allan Adler <ar*@nestle.csail.mit.edu> writes:
I'm trying to reinstall RedHat 7.1 Linux on a PC that was disabled when
I tried to upgrade from RH7.1 [....]
The file anaconda.real is invoked with the line
exec /usr/bin/anaconda.real -T "$@"
I don't know what effect the -T "$@" has.


Tiny progress on this: in a shell script, "$@" apparently lets you refer
to the output of a previous command. I don't know what output would be
relevant, since the last few lines of the shell script anaconda that
invokes anaconda.real are:

cd /usr/sbin
uncpio < sbin.cgz
rm sbin.cgz
cd /lib
uncpio < libs.cgz
rm libs.cgz
cd /
exec /usr/bin/anaconda.real -T "$@"

As for exec itself, the command line
exec -T
leads to a complaint that -T is an illegal option for exec, while
python -T
leads to a usage statement that doesn't list -T among the options for python.
So, I still don't understand the statement that is used to call the python
script anaconda.real.

I also tried to execute in interactive session some of the commands in the
file anaconda.real. E.g. the first command signal.signal(SIGINT,SIG_DFL)

Python 1.5.2 (#1, Mar 3 2001, 01:35:43)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2 on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
signal.signal(SIGINT,SIG_DFL) Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: signal import signal
signal.signal(SIGINT,SIG_DFL) Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: SIGINT import SIGINT

Traceback (innermost last):
File "<stdin>", line 1, in ?
ImportError: No module named SIGINT

On the other hand, while looking at Kernighan and Pike, "The Unix programming
environment" (1984), I fortuitously ran across a discussion of signals and
interrupts on p.225, including the example

#include <signal.h>
signal(SIGINT,SIG_DFL)

which restores default action for process termination. The resemblance to the
first command in anaconda.real is so close that I think the intention in
both must be the same. What is the right way to get python to do this?

The file anaconda.real doesn't explicitly execute
import signal
but it still somehow knows what signal means (my example session above shows
that it stops complaining about not knowing what signal means after I import
signal). Presumably there is some way of invoking python that causes signal
and other stuff to be imported automatically. What is it?
--
Ignorantly,
Allan Adler <ar*@zurich.csail.mit.edu>
* Disclaimer: I am a guest and *not* a member of the MIT CSAIL. My actions and
* comments do not reflect in any way on MIT. Also, I am nowhere near Boston.
Sep 7 '05 #4

P: n/a
Allan Adler wrote:
Allan Adler <ar*@nestle.csail.mit.edu> writes:

I'm trying to reinstall RedHat 7.1 Linux on a PC that was disabled when
I tried to upgrade from RH7.1 [....]
The file anaconda.real is invoked with the line
exec /usr/bin/anaconda.real -T "$@"
I don't know what effect the -T "$@" has.

Tiny progress on this: in a shell script, "$@" apparently lets you refer
to the output of a previous command. I don't know what output would be
relevant, since the last few lines of the shell script anaconda that
invokes anaconda.real are:

cd /usr/sbin
uncpio < sbin.cgz
rm sbin.cgz
cd /lib
uncpio < libs.cgz
rm libs.cgz
cd /
exec /usr/bin/anaconda.real -T "$@"

$@ doesn't refer to the output of a previous command. It refers to a
list of quoted arguments of the script it's a part of. It's supposed,
IIRC, to be equivalent to

exec /usr/bin/anaconda.real -T "$1" "$2" "$2" ...

as opposed to $*, which would be equivalent to

exec /usr/bin/anaconda.real -T $1 $2 $3 ...
As for exec itself, the command line
exec -T
leads to a complaint that -T is an illegal option for exec, while
python -T
leads to a usage statement that doesn't list -T among the options for python.
So, I still don't understand the statement that is used to call the python
script anaconda.real.
What's supposed to happen is that anaconda.real is supposed to be
processed by the Python interpreter. You will probably find a "shebang"
line at the start of anaconda.real that reads something like

#!/usr/bin/python1.5.2

The -T argument is, I suspect, intended for anaconda.real - you could
check the source and verify that it looks at sys.argv.
I also tried to execute in interactive session some of the commands in the
file anaconda.real. E.g. the first command signal.signal(SIGINT,SIG_DFL)

Python 1.5.2 (#1, Mar 3 2001, 01:35:43)
[GCC 2.96 20000731 (Red Hat Linux 7.1 2 on linux-i386
Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
signal.signal(SIGINT,SIG_DFL)
Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: signal
import signal
signal.signal(SIGINT,SIG_DFL)
Traceback (innermost last):
File "<stdin>", line 1, in ?
NameError: SIGINT
import SIGINT

Traceback (innermost last):
File "<stdin>", line 1, in ?
ImportError: No module named SIGINT

On the other hand, while looking at Kernighan and Pike, "The Unix programming
environment" (1984), I fortuitously ran across a discussion of signals and
interrupts on p.225, including the example

#include <signal.h>
signal(SIGINT,SIG_DFL)

which restores default action for process termination. The resemblance to the
first command in anaconda.real is so close that I think the intention in
both must be the same. What is the right way to get python to do this?

SIGINT is defined in the signal module so you probably want

signal.signal(signal.SIGINT, signal.SIG_DFL)
The file anaconda.real doesn't explicitly execute
import signal
but it still somehow knows what signal means (my example session above shows
that it stops complaining about not knowing what signal means after I import
signal). Presumably there is some way of invoking python that causes signal
and other stuff to be imported automatically. What is it?


On that one you have me stumped. It's possible it imports some other
module that plays with the namespace in a magical way.

regards
Steve
--
Steve Holden +44 150 684 7255 +1 800 494 3119
Holden Web LLC http://www.holdenweb.com/

Sep 7 '05 #5

This discussion thread is closed

Replies have been disabled for this discussion.