Ticket #10176: easy_install.py.debug.patch
File easy_install.py.debug.patch, 3.9 KB (added by , 12 years ago) |
---|
-
easy_install.py
old new 29 29 'main', 'get_exe_prefixes', 30 30 ] 31 31 32 33 import os 34 if os.environ.get("SAGE_SETUPTOOLS_DEBUG","no")=="yes": 35 log.set_threshold(log.DEBUG) 36 37 32 38 def samefile(p1,p2): 33 39 if hasattr(os.path,'samefile') and ( 34 40 os.path.exists(p1) and os.path.exists(p2) … … 945 951 if self.pth_file is None: 946 952 return 947 953 954 log.info( 955 "Updating easy-install.pth file: \"%s\"", 956 self.pth_file.filename 957 ) 958 948 959 for d in self.pth_file[dist.key]: # drop old entries 949 960 if self.multi_version or d.location != dist.location: 950 961 log.info("Removing %s from easy-install.pth file", d) 962 # LL MARKER 951 963 self.pth_file.remove(d) 952 964 if d.location in self.shadow_path: 953 965 self.shadow_path.remove(d.location) … … 960 972 ) 961 973 else: 962 974 log.info("Adding %s to easy-install.pth file", dist) 975 # LL MARKER 963 976 self.pth_file.add(dist) # add new entry 964 977 if dist.location not in self.shadow_path: 965 978 self.shadow_path.append(dist.location) … … 1327 1340 saw_import = False 1328 1341 seen = dict.fromkeys(self.sitedirs) 1329 1342 if os.path.isfile(self.filename): 1343 1344 log.debug( 1345 "Loading .pth file \"%s\"...", self.filename 1346 ) 1347 1330 1348 for line in open(self.filename,'rt'): 1331 1349 if line.startswith('import'): 1332 1350 saw_import = True … … 1335 1353 self.paths.append(path) 1336 1354 if not path.strip() or path.strip().startswith('#'): 1337 1355 continue 1356 1357 log.debug( 1358 " Path found: \"%s\"", path 1359 ) 1360 1338 1361 # skip non-existent paths, in case somebody deleted a package 1339 1362 # manually, and duplicate paths as well 1340 1363 path = self.paths[-1] = normalize_path( 1341 1364 os.path.join(self.basedir,path) 1342 1365 ) 1366 1367 log.debug( 1368 " Normalized: \"%s\"", path 1369 ) 1370 if not os.path.exists(path): 1371 log.debug( 1372 " ... does not exist - skipping" 1373 ) 1374 elif path in seen: 1375 log.debug( 1376 " ... already seen - skipping" 1377 ) 1378 1343 1379 if not os.path.exists(path) or path in seen: 1344 1380 self.paths.pop() # skip it 1345 1381 self.dirty = True # we cleaned up, so we're dirty now :) … … 1354 1390 def save(self): 1355 1391 """Write changed .pth file back to disk""" 1356 1392 if not self.dirty: 1393 log.debug( 1394 "Not saving .pth file \"%s\" since it is clean (unmodified).", 1395 self.filename 1396 ) 1357 1397 return 1358 1398 1399 log.debug( 1400 "Saving .pth file \"%s\"...", self.filename 1401 ) 1402 1359 1403 data = '\n'.join(map(self.make_relative,self.paths)) 1360 1404 if data: 1361 1405 log.debug("Saving %s", self.filename) … … 1401 1445 if npath==self.basedir: 1402 1446 parts.append(os.curdir) 1403 1447 parts.reverse() 1448 log.debug(" Making path relative: \"%s\" -> \"%s\"", 1449 path, sep.join(parts) 1450 ) 1404 1451 return sep.join(parts) 1405 1452 npath, last = os.path.split(npath) 1406 1453 parts.append(last) 1407 1454 else: 1455 log.debug(" Making path relative: \"%s\" (unchanged)", 1456 path 1457 ) 1408 1458 return path 1409 1459 1410 1460 def get_script_header(script_text, executable=sys_executable, wininst=False):