Add support for creating symbolic links on Windows

Replace all calls to os.symlink with platform_utils.symlink.

The Windows implementation calls into the CreateSymbolicLinkW Win32
API, as os.symlink is not supported.

Separate the Win32 API definitions into a separate module
platform_utils_win32 for clarity.

Change-Id: I0714c598664c2df93383734e609d948692c17ec5
This commit is contained in:
Renaud Paquay
2016-11-01 11:24:03 -07:00
committed by David Pursehouse
parent 2e70291162
commit d5cec5e752
4 changed files with 114 additions and 4 deletions

View File

@@ -32,6 +32,7 @@ else:
import gitc_utils
from git_config import GitConfig
from git_refs import R_HEADS, HEAD
import platform_utils
from project import RemoteSpec, Project, MetaProject
from error import ManifestParseError, ManifestInvalidRevisionError
@@ -166,7 +167,7 @@ class XmlManifest(object):
try:
if os.path.lexists(self.manifestFile):
os.remove(self.manifestFile)
os.symlink(os.path.join('manifests', name), self.manifestFile)
platform_utils.symlink(os.path.join('manifests', name), self.manifestFile)
except OSError as e:
raise ManifestParseError('cannot link manifest %s: %s' % (name, str(e)))