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

Side by Side Diff: test/symlinks/gyptest-symlinks.py

Issue 1454433002: Python 3 compatibility Base URL: https://chromium.googlesource.com/external/gyp.git@master
Patch Set: Rebase with master (4ec6c4e3a94bd04a6da2858163d40b2429b8aad1) Created 4 years, 8 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 unified diff | Download patch
OLDNEW
1 #!/usr/bin/env python 1 #!/usr/bin/env python
2 2
3 # Copyright (c) 2015 Google Inc. All rights reserved. 3 # Copyright (c) 2015 Google Inc. All rights reserved.
4 # Use of this source code is governed by a BSD-style license that can be 4 # Use of this source code is governed by a BSD-style license that can be
5 # found in the LICENSE file. 5 # found in the LICENSE file.
6 6
7 """ 7 """
8 Test that RelativePath(s, d) doesn't return a path starting with '..' when 8 Test that RelativePath(s, d) doesn't return a path starting with '..' when
9 s is textually below d, but is also a symlink to a file that is not below d. 9 s is textually below d, but is also a symlink to a file that is not below d.
10 10
(...skipping 10 matching lines...) Expand all
21 import sys 21 import sys
22 import tempfile 22 import tempfile
23 23
24 if sys.platform != 'win32': 24 if sys.platform != 'win32':
25 test = TestGyp.TestGyp() 25 test = TestGyp.TestGyp()
26 26
27 # Copy hello.gyp and hello.c to temporary named files, which will then be 27 # Copy hello.gyp and hello.c to temporary named files, which will then be
28 # symlinked back and processed. Note that we don't ask gyp to touch the 28 # symlinked back and processed. Note that we don't ask gyp to touch the
29 # original files at all; they are only there as source material for the copy. 29 # original files at all; they are only there as source material for the copy.
30 # That's why hello.gyp references symlink_hello.c instead of hello.c. 30 # That's why hello.gyp references symlink_hello.c instead of hello.c.
31 with tempfile.NamedTemporaryFile() as gyp_file: 31 with tempfile.NamedTemporaryFile(mode='w+') as gyp_file:
32 with tempfile.NamedTemporaryFile() as c_file: 32 with tempfile.NamedTemporaryFile(mode='w+') as c_file:
33 with open('hello.gyp') as orig_gyp_file: 33 with open('hello.gyp') as orig_gyp_file:
34 gyp_file.write(orig_gyp_file.read()) 34 gyp_file.write(orig_gyp_file.read())
35 gyp_file.flush() 35 gyp_file.flush()
36 with open('hello.c') as orig_c_file: 36 with open('hello.c') as orig_c_file:
37 c_file.write(orig_c_file.read()) 37 c_file.write(orig_c_file.read())
38 c_file.flush() 38 c_file.flush()
39 # We need to flush the files because we want to read them before closing 39 # We need to flush the files because we want to read them before closing
40 # them, since when they are closed they will be deleted. 40 # them, since when they are closed they will be deleted.
41 41
42 # Don't proceed with the test on a system that doesn't let you read from 42 # Don't proceed with the test on a system that doesn't let you read from
(...skipping 14 matching lines...) Expand all
57 os.symlink(gyp_file.name, symlink_gyp) 57 os.symlink(gyp_file.name, symlink_gyp)
58 os.symlink(c_file.name, symlink_c) 58 os.symlink(c_file.name, symlink_c)
59 59
60 # Run gyp on the symlinked files. 60 # Run gyp on the symlinked files.
61 test.run_gyp(symlink_gyp, chdir=outdir) 61 test.run_gyp(symlink_gyp, chdir=outdir)
62 test.build(symlink_gyp, chdir=outdir) 62 test.build(symlink_gyp, chdir=outdir)
63 test.run_built_executable('symlink_hello', stdout="Hello, world!\n", 63 test.run_built_executable('symlink_hello', stdout="Hello, world!\n",
64 chdir=outdir) 64 chdir=outdir)
65 65
66 test.pass_test() 66 test.pass_test()
OLDNEW

Powered by Google App Engine
This is Rietveld 408576698