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

Side by Side Diff: utils/build_externals.py

Issue 1595019: Merge remote branch 'origin/upstream' into tempbranch (Closed)
Patch Set: Created 10 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
« no previous file with comments | « server/standalone_profiler.py ('k') | utils/compile_gwt_clients.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/python
2 # 2 #
3 # Please keep this code python 2.4 compatible and stand alone. 3 # Please keep this code python 2.4 compatible and stand alone.
4 4
5 """ 5 """
6 Fetch, build and install external Python library dependancies. 6 Fetch, build and install external Python library dependancies.
7 7
8 This fetches external python libraries, builds them using your host's 8 This fetches external python libraries, builds them using your host's
9 python and installs them under our own autotest/site-packages/ directory. 9 python and installs them under our own autotest/site-packages/ directory.
10 10
11 Usage? Just run it. 11 Usage? Just run it.
12 utils/build_externals.py 12 utils/build_externals.py
13 """ 13 """
14 14
15 import compileall, logging, os, sha, shutil, sys, tempfile, time, urllib2 15 import compileall, logging, os, shutil, sys, tempfile, time, urllib2
16 import subprocess, re 16 import subprocess, re
17 import common 17 import common
18 from autotest_lib.client.common_lib import logging_config, logging_manager 18 from autotest_lib.client.common_lib import logging_config, logging_manager
19 from autotest_lib.client.common_lib import utils 19 from autotest_lib.client.common_lib import utils
20 from autotest_lib.utils import external_packages 20 from autotest_lib.utils import external_packages
21 21
22 # bring in site packages as well 22 # bring in site packages as well
23 utils.import_site_module(__file__, 'autotest_lib.utils.site_external_packages') 23 utils.import_site_module(__file__, 'autotest_lib.utils.site_external_packages')
24 24
25 # Where package source be fetched to relative to the top of the autotest tree. 25 # Where package source be fetched to relative to the top of the autotest tree.
(...skipping 51 matching lines...) Expand 10 before | Expand all | Expand 10 after
77 # for the source code before checking the directory of the .pyc file. 77 # for the source code before checking the directory of the .pyc file.
78 # Don't leave references to our temporary build dir in the files. 78 # Don't leave references to our temporary build dir in the files.
79 logging.info('compiling .py files in %s to .pyc', install_dir) 79 logging.info('compiling .py files in %s to .pyc', install_dir)
80 compileall.compile_dir(install_dir, quiet=True) 80 compileall.compile_dir(install_dir, quiet=True)
81 81
82 # Some things install with whacky permissions, fix that. 82 # Some things install with whacky permissions, fix that.
83 external_packages.system("chmod -R a+rX '%s'" % install_dir) 83 external_packages.system("chmod -R a+rX '%s'" % install_dir)
84 84
85 errors = fetch_errors + install_errors 85 errors = fetch_errors + install_errors
86 for error_msg in errors: 86 for error_msg in errors:
87 print >>sys.stderr, error_msg 87 logging.error(error_msg)
88 88
89 return len(errors) 89 return len(errors)
90 90
91 91
92 def fetch_necessary_packages(dest_dir, install_dir): 92 def fetch_necessary_packages(dest_dir, install_dir):
93 """ 93 """
94 Fetches all ExternalPackages into dest_dir. 94 Fetches all ExternalPackages into dest_dir.
95 95
96 @param dest_dir: Directory the packages should be fetched into. 96 @param dest_dir: Directory the packages should be fetched into.
97 @param install_dir: Directory where packages will later installed. 97 @param install_dir: Directory where packages will later installed.
(...skipping 11 matching lines...) Expand all
109 if names_to_check and package.name.lower() not in names_to_check: 109 if names_to_check and package.name.lower() not in names_to_check:
110 continue 110 continue
111 if not package.is_needed(install_dir): 111 if not package.is_needed(install_dir):
112 logging.info('A new %s is not needed on this system.', 112 logging.info('A new %s is not needed on this system.',
113 package.name) 113 package.name)
114 if INSTALL_ALL: 114 if INSTALL_ALL:
115 logging.info('Installing anyways...') 115 logging.info('Installing anyways...')
116 else: 116 else:
117 continue 117 continue
118 if not package.fetch(dest_dir): 118 if not package.fetch(dest_dir):
119 msg = '!!! Unable to download %s' % package.name 119 msg = 'Unable to download %s' % package.name
120 print msg 120 logging.error(msg)
121 errors.append(msg) 121 errors.append(msg)
122 else: 122 else:
123 fetched_packages.append(package) 123 fetched_packages.append(package)
124 124
125 return fetched_packages, errors 125 return fetched_packages, errors
126 126
127 127
128 def build_and_install_packages(packages, install_dir): 128 def build_and_install_packages(packages, install_dir):
129 """ 129 """
130 Builds and installs all packages into install_dir. 130 Builds and installs all packages into install_dir.
131 131
132 @param packages - A list of already fetched ExternalPackage instances. 132 @param packages - A list of already fetched ExternalPackage instances.
133 @param install_dir - Directory the packages should be installed into. 133 @param install_dir - Directory the packages should be installed into.
134 134
135 @returns A list of error messages for any installs that failed. 135 @returns A list of error messages for any installs that failed.
136 """ 136 """
137 errors = [] 137 errors = []
138 for package in packages: 138 for package in packages:
139 if not package.build_and_install(install_dir): 139 if not package.build_and_install(install_dir):
140 msg = '!!! Unable to build and install %s' % package.name 140 msg = 'Unable to build and install %s' % package.name
141 print msg 141 logging.error(msg)
142 errors.append(msg) 142 errors.append(msg)
143 return errors 143 return errors
144 144
145 145
146 if __name__ == '__main__': 146 if __name__ == '__main__':
147 sys.exit(main()) 147 sys.exit(main())
OLDNEW
« no previous file with comments | « server/standalone_profiler.py ('k') | utils/compile_gwt_clients.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698