diff --git a/config/JarMaker.py b/config/JarMaker.py index 22536ab7b4b..c4daf178993 100644 --- a/config/JarMaker.py +++ b/config/JarMaker.py @@ -56,6 +56,9 @@ from datetime import datetime from utils import pushback_iter, lockFile from Preprocessor import Preprocessor from buildlist import addEntriesToListFile +if sys.platform == "win32": + from ctypes import windll, WinError + CreateHardLink = windll.kernel32.CreateHardLinkA __all__ = ['JarMaker'] @@ -406,7 +409,7 @@ class JarMaker(object): if (m.group('optOverwrite') or (getModTime(realsrc) > outHelper.getDestModTime(m.group('output')))): - if self.outputFormat == 'symlink' and hasattr(os, 'symlink'): + if self.outputFormat == 'symlink': outHelper.symlink(realsrc, out) return outf = outHelper.getOutput(out) @@ -468,7 +471,13 @@ class JarMaker(object): except OSError, e: if e.errno != errno.ENOENT: raise - os.symlink(src, out) + if sys.platform != "win32": + os.symlink(src, out) + else: + # On Win32, use ctypes to create a hardlink + rv = CreateHardLink(out, src, None) + if rv == 0: + raise WinError() def main(): jm = JarMaker()