Changeset 9458


Ignore:
Timestamp:
Nov 30, 2014 7:59:18 PM (4 years ago)
Author:
wehart
Message:

A bug fix for Python2.6, which uses a different API.

My "fix" won't work on MS Windows...

File:
1 edited

Legend:

Unmodified
Added
Removed
  • pyomo/trunk/scripts/pyomo_install

    r9457 r9458  
    338338        tmp = []
    339339        import site
    340         for dir_ in site.getsitepackages():
    341             if dir_.startswith(sys.exec_prefix):
    342                 tmp.append( os.path.abspath(os.path.join(pyomo_install_tempdir, dir_[1:])) )
     340        if sys.version_info[:2] < (2,7):
     341            for dir_ in site.PREFIXES:
     342                    tmp.append( os.path.abspath(os.path.join(pyomo_install_tempdir, dir_[1:], 'lib/python2.6/site-packages')) )
     343        else:
     344            # The site.getsitepackages() method was first defined in Python 2.7
     345            for dir_ in site.getsitepackages():
     346                if dir_.startswith(sys.exec_prefix):
     347                    tmp.append( os.path.abspath(os.path.join(pyomo_install_tempdir, dir_[1:])) )
    343348        os.environ['PYTHONPATH'] = os.pathsep.join( tmp )
    344349        #print(os.environ['PYTHONPATH'])
Note: See TracChangeset for help on using the changeset viewer.