Skip to content
This repository was archived by the owner on Feb 25, 2025. It is now read-only.

Commit a339ed1

Browse files
committed
Merge pull request #99 from abarth/fix_symlink
Fix build issues related to symlink.py
2 parents 6488bca + 48be0d1 commit a339ed1

File tree

4 files changed

+48
-8
lines changed

4 files changed

+48
-8
lines changed

build/symlink.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99
import errno
1010
import optparse
1111
import os.path
12+
import shutil
1213
import sys
1314

1415

@@ -25,11 +26,16 @@ def Main(argv):
2526
sources = args[:-1]
2627
for s in sources:
2728
t = os.path.join(target, os.path.basename(s))
29+
if len(sources) == 1 and not os.path.isdir(target):
30+
t = target
2831
try:
2932
os.symlink(s, t)
3033
except OSError, e:
3134
if e.errno == errno.EEXIST and options.force:
32-
os.remove(t)
35+
if os.path.isdir(t):
36+
shutil.rmtree(t, ignore_errors=True)
37+
else:
38+
os.remove(t)
3339
os.symlink(s, t)
3440
else:
3541
raise

sky/build/symlink.py

Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
#!/usr/bin/env python
2+
# Copyright (c) 2013 The Chromium Authors. All rights reserved.
3+
# Use of this source code is governed by a BSD-style license that can be
4+
# found in the LICENSE file.
5+
6+
import errno
7+
import optparse
8+
import os.path
9+
import shutil
10+
import sys
11+
12+
13+
def main(argv):
14+
parser = optparse.OptionParser()
15+
parser.add_option('--touch')
16+
17+
options, args = parser.parse_args(argv[1:])
18+
if len(args) != 2:
19+
parser.error('Two arguments required.')
20+
21+
source = os.path.abspath(args[0])
22+
target = os.path.abspath(args[1])
23+
try:
24+
os.symlink(source, target)
25+
except OSError, e:
26+
if e.errno == errno.EEXIST:
27+
os.remove(target)
28+
os.symlink(source, target)
29+
30+
if options.touch:
31+
with open(os.path.abspath(options.touch), 'w') as f:
32+
pass
33+
34+
35+
if __name__ == '__main__':
36+
sys.exit(main(sys.argv))

sky/sdk/BUILD.gn

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,8 @@ dart_pkg("sky") {
125125
}
126126

127127
action("material_design_icons") {
128-
input_dir = "lib/assets/material-design-icons"
129-
output_dir = "$root_gen_dir/dart-pkg/sky/lib/assets"
128+
source_file = "lib/assets/material-design-icons"
129+
target_file = "$root_gen_dir/dart-pkg/sky/lib/assets/material-design-icons"
130130
stamp = "$target_gen_dir/material_design_icons_linked"
131131

132132
sources = [
@@ -136,11 +136,10 @@ action("material_design_icons") {
136136
stamp,
137137
]
138138

139-
script = "//build/symlink.py"
139+
script = "//sky/build/symlink.py"
140140
args = [
141-
"--force",
142-
rebase_path(input_dir, output_dir),
143-
rebase_path(output_dir, root_build_dir),
141+
rebase_path(source_file, root_build_dir),
142+
rebase_path(target_file, root_build_dir),
144143
"--touch",
145144
rebase_path(stamp, root_build_dir),
146145
]

sky/tools/roll/roll.py

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@
9797
'build/config/ui.gni',
9898
'build/ls.py',
9999
'build/module_args/mojo.gni',
100-
'build/symlink.py',
101100
'tools/android/VERSION_LINUX_NDK',
102101
'tools/android/VERSION_LINUX_SDK',
103102
'tools/android/VERSION_MACOSX_NDK',

0 commit comments

Comments
 (0)