[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

Re: Automatic python requires



Jeff MacDonald wrote:
On Wednesday 30 April 2008 3:03:05 am Christian Iseli wrote:
Given that we are packaging for a specific distro, I think the case
could even be argued that the packager should replace all
#! /usr/bin/env <interpreter>
with
#! /usr/bin/<interpreter>
to make the distro consistent.


-1: the distro already consistently uses /usr/bin/env, and I vote to keep it that way. :)

No it doesn't.

$ ./env-py.py
/usr/bin/env 55
/usr/bin/python: 182

(That's roughly /usr/bin/env python, BTW.  script attached.)

-Toshio
#!/usr/bin/python -tt

import glob

def opener(filename):
    try:
        return file(filename, 'r')
    except:
        return file('/dev/zero','r')

def first_lines():
    files = (opener(filename) for filename in glob.glob('/usr/bin/*'))
    chunks = (program.readline(64) for program in files)
    return chunks

if __name__ == '__main__':
    envMatchFile = file('/var/tmp/envMatch','w')
    envMatches = [match for match in first_lines() if match.find('/usr/bin/env') != -1]
    pyMatches = [match for match in envMatches if match.find('python') != -1]
    envMatchFile.write('\n'.join(pyMatches))
    envMatchFile.close()
    print '/usr/bin/env', len(pyMatches)

    pyMatchFile = file('/var/tmp/pyMatch','w')
    pyMatches = [match for match in first_lines() if match.find('/usr/bin/python') != -1]
    pyMatchFile.write('\n'.join(pyMatches))
    pyMatchFile.close()
    print '/usr/bin/python:', len(pyMatches)

[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]