I can't make out the different between portage.abssymlink and
os.path.realpath, besides that realpath is used a LOT more in portage
and abssympath dies if it gets passed something that's not a symlink.
Let's get rid of it!
1st patch is for trunk/pym/__init__.py
2nd patch is for trunk/pym/dbapi/vartree.py (only actual instance of
abssymlink left)
-Doug
--- __init__.py.old 2009-03-10 21:07:06.000000000 +0900
+++ __init__.py 2009-03-10 21:20:34.000000000 +0900
@@ -180,12 +180,10 @@ def getcwd():
getcwd()
def abssymlink(symlink):
- "This reads symlinks, resolving the relative symlinks, and returning the absolute."
- mylink=os.readlink(symlink)
- if mylink[0] != '/':
- mydir=os.path.dirname(symlink)
- mylink=mydir+"/"+mylink
- return os.path.normpath(mylink)
+ "Not currently used by Portage (DEPRECATED 03/2009)"
+ writemsg("DEPRECATED: portage.abssymlink: use os.path.realpath instead\n",
+ noiselevel=-1)
+ return os.path.realpath(symlink)
dircache = {}
cacheHit=0
--- vartree.py.old 2009-03-10 21:14:12.000000000 +0900
+++ vartree.py 2009-03-10 21:16:07.000000000 +0900
@@ -3,8 +3,18 @@
# $Id$
__all__ = ["PreservedLibsRegistry", "LinkageMap",
- "vardbapi", "vartree", "dblink"] + \
- ["write_contents", "tar_contents"]
+ "vardbapi", "vartree", "dblink", "write_contents", "tar_contents"]
+
+import os, re, shutil, stat, errno, copy, subprocess
+import logging
+import shlex
+import sys
+from itertools import izip
+
+try:
+ import cPickle as pickle
+except ImportError:
+ import pickle
import portage
portage.proxy.lazyimport.lazyimport(globals(),
@@ -32,20 +42,10 @@ from portage.exception import CommandNot
from portage import listdir, dep_expand, digraph, flatten, key_expand, \
doebuild_environment, doebuild, env_update, prepare_build_dirs, \
- abssymlink, movefile, _movefile, bsd_chflags, cpv_getkey
+ movefile, _movefile, bsd_chflags, cpv_getkey
from portage.cache.mappings import slot_dict_class
-import os, re, shutil, stat, errno, copy, subprocess
-import logging
-import shlex
-import sys
-from itertools import izip
-
-try:
- import cPickle as pickle
-except ImportError:
- import pickle
class PreservedLibsRegistry(object):
""" This class handles the tracking of preserved library objects """
@@ -3649,7 +3649,7 @@ class dblink(object):
if stat.S_ISLNK(mymode):
# we are merging a symbolic link
- myabsto = abssymlink(mysrc)
+ myabsto = os.path.realpath(mysrc)
if myabsto.startswith(srcroot):
myabsto = myabsto[len(srcroot):]
myabsto = myabsto.lstrip(sep)