Commits

Anonymous committed b74c0e8

Warn about sys.prefix not being set, assure GnuMakefile has relative paths

  • Participants
  • Parent commits 24918e8

Comments (0)

Files changed (3)

pypy/doc/getting-started-python.rst

     ../../..
     etc.
 
+If the executable fails to find suitable libraries, it will report
+``debug: WARNING: library path not found, using compiled-in sys.path``
+and then attempt to continue normally.  If the default path is usable,
+most code will be fine.  However, the ``sys.prefix`` will be unset
+and some existing libraries assume that this is never the case.
+
 In order to use ``distutils`` or ``setuptools`` a directory ``PREFIX/site-packages`` needs to be created. Here's an example session setting up and using ``easy_install``::
 
     $ cd PREFIX

pypy/translator/goal/app_main.py

         if dirname == search:
             # not found!  let's hope that the compiled-in path is ok
             print >> sys.stderr, ('debug: WARNING: library path not found, '
-                                  'using compiled-in sys.path')
+                                  'using compiled-in sys.path '
+                                  'and sys.prefix will be unset')
             newpath = sys.path[:]
             break
         newpath = sys.pypy_initial_path(dirname)

pypy/translator/platform/posix.py

         m.eci = eci
 
         def pypyrel(fpath):
-            rel = py.path.local(fpath).relto(pypypath)
+            lpath = py.path.local(fpath)
+            rel = lpath.relto(pypypath)
             if rel:
                 return os.path.join('$(PYPYDIR)', rel)
-            else:
-                return fpath
+            m_dir = m.makefile_dir
+            if m_dir == lpath:
+                return '.'
+            if m_dir.dirpath() == lpath:
+                return '..'
+            return fpath
 
         rel_cfiles = [m.pathrel(cfile) for cfile in cfiles]
         rel_ofiles = [rel_cfile[:-2]+'.o' for rel_cfile in rel_cfiles]