Well, I switched "python" to 2.0 some time ago on Debian, and I've had
very few problems (pysol is the only one I can remember).
Of course, I'm sure there are packages I don't use that do cause these
problems.
A general "change the first line of everything" script would probably
be useful anyway -- some systems have broken /usr/bin/env's anyway.
It could be something like:
import os, sys, string
def changeAll(dir, replaceFirst):
for filename in os.listdir(dir):
filename = os.path.join(dir, filename)
if filename[-3:] == ".py":
l = open(filename).readline()
if l[:2] == "#!" and string.find(l, "python") != -1:
fixup(filename, replaceFirst)
if os.path.isdir(filename):
changeAll(filename)
def fixup(filename, replaceFirst):
f = open(filename)
l = f.readline()
rest = f.read()
f.close()
assert l[:2] == "#!"
newl = "#!" + replaceFirst
os.unlink(filename)
f = open(filename, "w")
f.write(newl)
f.write(rest)
f.close()
print "updated %s" % filename
if __name__ == "__main__":
if not sys.argv[1:]:
print "Usage: fixup '/path/to/python' [directories]"
sys.exit()
replacer = sys.argv[1]
rootDirs = sys.argv[2:] or ["."]
for dir in rootDir:
changeAll(dir)
[EMAIL PROTECTED] wrote:
> Pretty much all the Webware and 3rd party plug-ins invoke the Python
> interpreter by calling "#!/usr/bin/env python" in their scripts. The
> trouble with this is that this call brings up Python 1.5.2 in Debian.
>
> The only ways I can think of to get Python 2 invoked instead is to use the
> Debian alternatives system, or else search through all Webware + plug-in
> code to change "#!/usr/bin/env python" --> "#!/usr/bin/env python2".
>
> Neither option seems good. Messing with the Webware code means that I can't
> keep current easily. Using the alternatives system to point /usr/bin/python
> at python2 will break some Debian packages that depend on 1.5.2, and which
> rely on /usr/bin/python to point to Python 1.5.2.
>
> Indeed, there is quite a raging debate going on now amongst Debian
> developers about about how to deal with this kind of problem (and others):
>
>http://groups.google.com/groups?hl=en&th=d8b5f0e26b68ff35&seekm=87itdf28b3.fsf%40marant.org#link1
>
> So, if you use Debian, Webware and Python2, how did you manage to keep the
> balls in the air at once?
>
> ...Edmund.
>
>
> _______________________________________________
> Webware-discuss mailing list
> [EMAIL PROTECTED]
> https://lists.sourceforge.net/lists/listinfo/webware-discuss
>
_______________________________________________
Webware-discuss mailing list
[EMAIL PROTECTED]
https://lists.sourceforge.net/lists/listinfo/webware-discuss