Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(987)

Unified Diff: dart/tools/make_links.py

Issue 315943003: Packages for Try Dart and dart2js. (Closed) Base URL: https://dart.googlecode.com/svn/branches/bleeding_edge
Patch Set: Merged with r37435. Created 6 years, 6 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « dart/pkg/pkg.gyp ('k') | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: dart/tools/make_links.py
diff --git a/dart/tools/make_links.py b/dart/tools/make_links.py
index 1893f2d41ac6906022423e0b67a106e89196e888..5061c26f07b8008fcdea34f9541f652b1427cc09 100644
--- a/dart/tools/make_links.py
+++ b/dart/tools/make_links.py
@@ -32,7 +32,7 @@ def get_options():
default='')
return result.parse_args()
-def make_link(source, target):
+def make_link(source, target, orig_source):
if os.path.islink(target):
print 'Removing %s' % target
sys.stdout.flush()
@@ -43,13 +43,19 @@ def make_link(source, target):
sys.stdout.flush()
os.rmdir(target)
- print 'Creating link from %s to %s' % (source, target)
- sys.stdout.flush()
-
- if utils.GuessOS() == 'win32':
- return subprocess.call(['mklink', '/j', target, source], shell=True)
+ if os.path.isfile(orig_source):
+ print 'Copying file from %s to %s' % (orig_source, target)
+ sys.stdout.flush()
+ shutil.copyfile(orig_source, target)
+ return 0
else:
- return subprocess.call(['ln', '-s', source, target])
+ print 'Creating link from %s to %s' % (source, target)
+ sys.stdout.flush()
+
+ if utils.GuessOS() == 'win32':
+ return subprocess.call(['mklink', '/j', target, source], shell=True)
+ else:
+ return subprocess.call(['ln', '-s', source, target])
def create_timestamp_file(options):
if options.timestamp_file != '':
@@ -82,11 +88,12 @@ def main(argv):
name = source
# Remove any addtional path components preceding NAME.
(path, name) = os.path.split(name)
+ orig_source = source
if utils.GuessOS() == 'win32':
source = os.path.relpath(source)
else:
source = os.path.relpath(source, start=target)
- exit_code = make_link(source, os.path.join(target, name))
+ exit_code = make_link(source, os.path.join(target, name), orig_source)
if exit_code != 0:
return exit_code
create_timestamp_file(options)
« no previous file with comments | « dart/pkg/pkg.gyp ('k') | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698