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

Side by Side Diff: chrome/test/pyautolib/generate_docs.py

Issue 8680018: Fix python scripts in src/chrome/ (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/src
Patch Set: copyright Created 9 years 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 | Annotate | Revision Log
« no previous file with comments | « chrome/test/pyautolib/fetch_prebuilt_pyauto.py ('k') | chrome/test/pyautolib/history_info.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 #!/usr/bin/python 1 #!/usr/bin/env python
2 # Copyright (c) 2011 The Chromium Authors. All rights reserved. 2 # Copyright (c) 2011 The Chromium Authors. All rights reserved.
3 # Use of this source code is governed by a BSD-style license that can be 3 # Use of this source code is governed by a BSD-style license that can be
4 # found in the LICENSE file. 4 # found in the LICENSE file.
5 5
6 import optparse 6 import optparse
7 import os 7 import os
8 import pydoc 8 import pydoc
9 import shutil 9 import shutil
10 import sys 10 import sys
11 11
(...skipping 17 matching lines...) Expand all
29 '../../../third_party/')) 29 '../../../third_party/'))
30 sys.path.append(options.pyautolib) 30 sys.path.append(options.pyautolib)
31 31
32 # Get a snapshot of the current directory where pydoc will export the files 32 # Get a snapshot of the current directory where pydoc will export the files
33 previous_contents = set(os.listdir(os.getcwd())) 33 previous_contents = set(os.listdir(os.getcwd()))
34 pydoc.writedocs(options.pyautolib) 34 pydoc.writedocs(options.pyautolib)
35 current_contents = set(os.listdir(os.getcwd())) 35 current_contents = set(os.listdir(os.getcwd()))
36 36
37 if options.dir == os.getcwd(): 37 if options.dir == os.getcwd():
38 print 'Export complete, files are located in %s' % options.dir 38 print 'Export complete, files are located in %s' % options.dir
39 return 39 return 1
40 40
41 new_files = current_contents.difference(previous_contents) 41 new_files = current_contents.difference(previous_contents)
42 for file_name in new_files: 42 for file_name in new_files:
43 basename, extension = os.path.splitext(file_name) 43 basename, extension = os.path.splitext(file_name)
44 if extension == '.html': 44 if extension == '.html':
45 # Build the complete path 45 # Build the complete path
46 full_path = os.path.join(os.getcwd(), file_name) 46 full_path = os.path.join(os.getcwd(), file_name)
47 existing_file_path = os.path.join(options.dir, file_name) 47 existing_file_path = os.path.join(options.dir, file_name)
48 if os.path.isfile(existing_file_path): 48 if os.path.isfile(existing_file_path):
49 os.remove(existing_file_path) 49 os.remove(existing_file_path)
50 shutil.move(full_path, options.dir) 50 shutil.move(full_path, options.dir)
51 51
52 print 'Export complete, files are located in %s' % options.dir 52 print 'Export complete, files are located in %s' % options.dir
53 return 0
53 54
54 55
55 if __name__ == '__main__': 56 if __name__ == '__main__':
56 main() 57 sys.exit(main())
57
OLDNEW
« no previous file with comments | « chrome/test/pyautolib/fetch_prebuilt_pyauto.py ('k') | chrome/test/pyautolib/history_info.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698