Bug 634596 - On Windows, use hardlinks when --enable-chrome-format=symlink is specified. r=ted

This commit is contained in:
Siddharth Agarwal 2011-03-01 23:58:24 +05:30
Родитель 4a47b59374
Коммит a61b14eb60
1 изменённых файлов: 11 добавлений и 2 удалений

Просмотреть файл

@ -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()