Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Delta Between Two Patch Sets: third_party/libadblockplus/prepare_dependencies.py

Issue 29674555: Issue 6273 - Apply eyeo python code style (Closed)
Left Patch Set: Addressed Vasily's comments Created Jan. 22, 2018, 7:11 a.m.
Right Patch Set: Removed sys.exit() where return code is always 0 Created Jan. 29, 2018, 12:50 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
Left: Side by side diff | Download
Right: Side by side diff | Download
« no previous file with change/comment | « third_party/libadblockplus/download_ndk.py ('k') | third_party/libadblockplus_android/prepare_build_tools.py » ('j') | no next file with change/comment »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
LEFTRIGHT
1 from __future__ import print_function 1 from __future__ import print_function
2 2
3 import sys 3 import sys
4 import os 4 import os
5 import shutil 5 import shutil
6 6
7 7
8 def duplicate(src, dst, symlink=False): 8 def duplicate(src, dst, symlink=False):
sergei 2018/01/22 10:08:59 It seems that symlink parameter is not passed, sho
sergei 2018/01/22 10:10:32 BTW, what about moving this function into common f
anton 2018/01/22 10:18:41 Since it's not used anywhere else (and will not be
anton 2018/01/22 10:18:41 Vasily noted it too. Please ready my answer https:
sergei 2018/01/22 12:04:02 Acknowledged, maybe it makes sense.
9 if os.path.exists(dst): 9 if os.path.exists(dst):
10 if os.path.isdir(dst): 10 if os.path.isdir(dst):
11 print('Deleting {}'.format(dst)) 11 print('Deleting {}'.format(dst))
12 shutil.rmtree(dst) 12 shutil.rmtree(dst)
13 else: 13 else:
14 # symlink 14 # symlink
15 os.unlink(dst) 15 os.unlink(dst)
sergei 2018/01/22 12:04:02 Actually, according to the documentation "This fol
16 16
17 dst_parent = os.path.abspath(os.path.join(dst, os.pardir)) 17 dst_parent = os.path.abspath(os.path.join(dst, os.pardir))
18 if not os.path.exists(dst_parent): 18 if not os.path.exists(dst_parent):
19 print('Creating parent directory {} for {}'.format(dst_parent, dst)) 19 print('Creating parent directory {} for {}'.format(dst_parent, dst))
20 os.makedirs(dst_parent) 20 os.makedirs(dst_parent)
21 21
22 if symlink: 22 if symlink:
23 print('Symlinking {} to {}'.format(src, dst)) 23 print('Symlinking {} to {}'.format(src, dst))
24 os.symlink(src, dst) 24 os.symlink(src, dst)
25 else: 25 else:
(...skipping 26 matching lines...) Expand all
52 shutil.move(gtest_bak_src, gtest_bak_dst) 52 shutil.move(gtest_bak_src, gtest_bak_dst)
53 53
54 # v8 54 # v8
55 v8_src = os.path.join(cwd, 'src', 'v8') 55 v8_src = os.path.join(cwd, 'src', 'v8')
56 v8_dst = os.path.join(libadblockplus_third_party, 'v8') 56 v8_dst = os.path.join(libadblockplus_third_party, 'v8')
57 duplicate(v8_src, v8_dst) 57 duplicate(v8_src, v8_dst)
58 58
59 # restore /v8/testing/gtest from backup 59 # restore /v8/testing/gtest from backup
60 shutil.move(gtest_bak_dst, gtest_bak_src) 60 shutil.move(gtest_bak_dst, gtest_bak_src)
61 61
62 # v8/testing/gtest 62 # v8/testing/gtest
sergei 2018/01/22 10:08:59 I thought that v8/testing/gtest is not used in lib
anton 2018/01/22 10:18:41 then why it's listed in dependencies https://githu
63 # 63 #
64 # Chromium's gtest can't be used becuase of compile error: 64 # Chromium's gtest can't be used becuase of compile error:
65 # fatal error: third_party/googletest/src/googletest/include/gtest/gtest_pro d.h: No such file or directory 65 # fatal error: third_party/googletest/src/googletest/include/gtest/gtest_pro d.h: No such file or directory
66 # #include "third_party/googletest/src/googletest/include/gtest/gtest_prod.h " 66 # #include "third_party/googletest/src/googletest/include/gtest/gtest_prod.h "
67 # so we have to back-up gtest above and restore it 67 # so we have to back-up gtest above and restore it
68 # after prepring of 'v8' directory 68 # after prepring of 'v8' directory
69 69
70 for path in [ 70 for path in [
sergei 2018/01/22 10:08:59 Will it stop working if we remove this for loop? A
anton 2018/01/22 10:18:41 They are copied not from v8_src but from different
sergei 2018/01/22 12:04:02 Acknowledged. I think the comments should be diffe
sergei 2018/01/24 17:23:40 No objections, could you please file an issue for
71 ('base', 'trace_event', 'common'), 71 ('base', 'trace_event', 'common'),
72 ('build',), 72 ('build',),
73 ('tools', 'gyp'), 73 ('tools', 'gyp'),
74 ('tools', 'clang'), 74 ('tools', 'clang'),
75 ('third_party', 'icu'), 75 ('third_party', 'icu'),
76 ('third_party' , 'jinja2'), 76 ('third_party' , 'jinja2'),
77 ('third_party', 'markupsafe') 77 ('third_party', 'markupsafe')
78 ]: 78 ]:
79 src = os.path.join(cwd, 'src', *path) 79 src = os.path.join(cwd, 'src', *path)
80 dst = os.path.join(libadblockplus_third_party, 'v8', *path) 80 dst = os.path.join(libadblockplus_third_party, 'v8', *path)
81 duplicate(src, dst) 81 duplicate(src, dst)
82 82
83 return 0
84
85 83
86 if __name__ == '__main__': 84 if __name__ == '__main__':
87 try: 85 try:
88 sys.exit(prepare_deps()) 86 prepare_deps()
Vasily Kuznetsov 2018/01/29 12:39:12 As I wrote before, you don't really need `sys.exit
anton 2018/01/29 12:52:53 Acknowledged. See patch set #3 (thought i've left
89 except KeyboardInterrupt: 87 except KeyboardInterrupt:
90 sys.exit('interrupted') 88 sys.exit('interrupted')
LEFTRIGHT

Powered by Google App Engine
This is Rietveld