##// END OF EJS Templates
setup.py: don't rewrite @LIBDIR@ when creating wheels...
Gregory Szorc -
r27269:bdcbec65 default
parent child Browse files
Show More
@@ -479,6 +479,25 b' class hginstallscripts(install_scripts):'
479 def run(self):
479 def run(self):
480 install_scripts.run(self)
480 install_scripts.run(self)
481
481
482 # It only makes sense to replace @LIBDIR@ with the install path if
483 # the install path is known. For wheels, the logic below calculates
484 # the libdir to be "../..". This is because the internal layout of a
485 # wheel archive looks like:
486 #
487 # mercurial-3.6.1.data/scripts/hg
488 # mercurial/__init__.py
489 #
490 # When installing wheels, the subdirectories of the "<pkg>.data"
491 # directory are translated to system local paths and files therein
492 # are copied in place. The mercurial/* files are installed into the
493 # site-packages directory. However, the site-packages directory
494 # isn't known until wheel install time. This means we have no clue
495 # at wheel generation time what the installed site-packages directory
496 # will be. And, wheels don't appear to provide the ability to register
497 # custom code to run during wheel installation. This all means that
498 # we can't reliably set the libdir in wheels: the default behavior
499 # of looking in sys.path must do.
500
482 if (os.path.splitdrive(self.install_dir)[0] !=
501 if (os.path.splitdrive(self.install_dir)[0] !=
483 os.path.splitdrive(self.install_lib)[0]):
502 os.path.splitdrive(self.install_lib)[0]):
484 # can't make relative paths from one drive to another, so use an
503 # can't make relative paths from one drive to another, so use an
@@ -500,6 +519,14 b' class hginstallscripts(install_scripts):'
500 if b('\0') in data:
519 if b('\0') in data:
501 continue
520 continue
502
521
522 # During local installs, the shebang will be rewritten to the final
523 # install path. During wheel packaging, the shebang has a special
524 # value.
525 if data.startswith(b'#!python'):
526 log.info('not rewriting @LIBDIR@ in %s because install path '
527 'not known' % outfile)
528 continue
529
503 data = data.replace(b('@LIBDIR@'), libdir.encode(libdir_escape))
530 data = data.replace(b('@LIBDIR@'), libdir.encode(libdir_escape))
504 fp = open(outfile, 'wb')
531 fp = open(outfile, 'wb')
505 fp.write(data)
532 fp.write(data)
General Comments 0
You need to be logged in to leave comments. Login now