Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 29 Oct 2007 10:20:11 +0100
From:      Pav Lucistnik <pav@FreeBSD.org>
To:        Hye-Shik Chang <perky@FreeBSD.org>
Cc:        python@FreeBSD.org
Subject:   Re: [Fwd: py25-TurboKid-1.0.1 pkg-plist errors on amd64 5]
Message-ID:  <1193649611.58220.16.camel@pav.hide.vol.cz>
In-Reply-To: <20071029011436.GA4293@FreeBSD.org>
References:  <1193387022.70430.11.camel@pav.hide.vol.cz> <20071029011436.GA4293@FreeBSD.org>

index | next in thread | previous in thread | raw e-mail

[-- Attachment #1 --]
Hye-Shik Chang píše v po 29. 10. 2007 v 10:14 +0900:
> On Fri, Oct 26, 2007 at 10:23:42AM +0200, Pav Lucistnik wrote:
> > Still have plist problem after your recent bsd.python.mk changes
> > 
> 
> Hmm.  The problem doesn't happen on my machine.  Can I see the
> content of site.py that the port leaked?

I have no trouble reproducing it with marcuscom's Tinderbox.
site.py content follows:


def __boot():
    import sys, imp, os, os.path   
    PYTHONPATH = os.environ.get('PYTHONPATH')
    if PYTHONPATH is None or (sys.platform=='win32' and not PYTHONPATH):
        PYTHONPATH = []
    else:
        PYTHONPATH = PYTHONPATH.split(os.pathsep)

    pic = getattr(sys,'path_importer_cache',{})
    stdpath = sys.path[len(PYTHONPATH):]
    mydir = os.path.dirname(__file__)
    #print "searching",stdpath,sys.path

    for item in stdpath:
        if item==mydir or not item:
            continue    # skip if current dir. on Windows, or my own directory
        importer = pic.get(item)
        if importer is not None:
            loader = importer.find_module('site')
            if loader is not None:
                # This should actually reload the current module
                loader.load_module('site')
                break
        else:
            try:
                stream, path, descr = imp.find_module('site',[item])
            except ImportError:
                continue
            if stream is None:
                continue
            try:
                # This should actually reload the current module
                imp.load_module('site',stream,path,descr)
            finally:
                stream.close()
            break
    else:
        raise ImportError("Couldn't find the real 'site' module")

    #print "loaded", __file__

    known_paths = dict([(makepath(item)[1],1) for item in sys.path]) # 2.2 comp

    oldpos = getattr(sys,'__egginsert',0)   # save old insertion position
    sys.__egginsert = 0                     # and reset the current one

    for item in PYTHONPATH:
        addsitedir(item)

    sys.__egginsert += oldpos           # restore effective old position
    
    d,nd = makepath(stdpath[0])
    insert_at = None
    new_path = []

    for item in sys.path:
        p,np = makepath(item)

        if np==nd and insert_at is None:
            # We've hit the first 'system' path entry, so added entries go here
            insert_at = len(new_path)

        if np in known_paths or insert_at is None:
            new_path.append(item)
        else:
            # new path after the insert point, back-insert it
            new_path.insert(insert_at, item)
            insert_at += 1
            
    sys.path[:] = new_path

if __name__=='site':    
    __boot()
    del __boot
    





-- 
Pav Lucistnik <pav@oook.cz>
              <pav@FreeBSD.org>

Oh, no! Aaargh! It is the most unnatural, most disgusting
creature imaginable: a two-eyed cyclops!

[-- Attachment #2 --]
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (FreeBSD)

iD8DBQBHJaXLntdYP8FOsoIRAvslAJ0cTT9u7qEBpw4MM0MMBZ9duIElSgCfX43e
h15qZmAy60fB2YnRwNQrkjw=
=5NXn
-----END PGP SIGNATURE-----
help

Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1193649611.58220.16.camel>