Merge lp:~dobey/ubuntuone-windows-installer/update-3-0 into lp:ubuntuone-windows-installer/stable-3-0
- update-3-0
- Merge into stable-3-0
Proposed by
dobey
on 2012-06-14
| Status: | Merged |
|---|---|
| Approved by: | Brian Curtin on 2012-06-14 |
| Approved revision: | 110 |
| Merged at revision: | 109 |
| Proposed branch: | lp:~dobey/ubuntuone-windows-installer/update-3-0 |
| Merge into: | lp:ubuntuone-windows-installer/stable-3-0 |
| Diff against target: |
835 lines (+690/-35) 9 files modified
scripts/build_installer.py (+115/-0) scripts/devsetup/README.txt (+39/-0) scripts/devsetup/bootstrap.py (+262/-0) scripts/devsetup/buildout.cfg (+98/-0) scripts/devsetup/env.bat (+79/-0) scripts/devsetup/get_protoc.py (+33/-0) scripts/devsetup/updateall.bat (+23/-0) scripts/setup.py (+37/-4) scripts/ubuntuone.xml (+4/-31) |
| To merge this branch: | bzr merge lp:~dobey/ubuntuone-windows-installer/update-3-0 |
| Related bugs: |
| Reviewer | Review Type | Date Requested | Status |
|---|---|---|---|
| Brian Curtin (community) | 2012-06-14 | Approve on 2012-06-14 | |
|
Review via email:
|
|||
Commit Message
[Alejandro Cura]
- Include the ValiCert certificate in the packaging (LP: #882062).
- Syncdaemon expects proxy-tunnel to output port info to stdout. (LP: #1006899)
[Brian Curtin]
Update pep8 to version 1.1
- Look in BitRock's installation folder for output files when running on Jenkins
- Correct a missing import statement from a previous merge.
- Allow build_installer.py to work on Server 2008 for build automation.
- Automate the building and packaging of the Windows installer
- Implement a buildout to create a simple, reproducible development environment.
Description of the Change
To post a comment you must log in.
review:
Approve
Preview Diff
[H/L] Next/Prev Comment, [J/K] Next/Prev File, [N/P] Next/Prev Hunk
| 1 | === added file 'scripts/build_installer.py' |
| 2 | --- scripts/build_installer.py 1970-01-01 00:00:00 +0000 |
| 3 | +++ scripts/build_installer.py 2012-06-14 21:21:31 +0000 |
| 4 | @@ -0,0 +1,115 @@ |
| 5 | +from __future__ import print_function |
| 6 | +from collections import namedtuple |
| 7 | +from platform import platform |
| 8 | +import os |
| 9 | +import shutil |
| 10 | +import subprocess |
| 11 | +import sys |
| 12 | +import time |
| 13 | + |
| 14 | +try: |
| 15 | + import _winreg as winreg |
| 16 | +except ImportError: |
| 17 | + import winreg |
| 18 | + |
| 19 | +def _which_python(): |
| 20 | + for dir in os.environ.get("Path").split(os.pathsep): |
| 21 | + full_path = os.path.join(dir, "python.exe") |
| 22 | + if os.path.exists(full_path): |
| 23 | + return full_path |
| 24 | + return None |
| 25 | + |
| 26 | +BRCommand = namedtuple("BRCommand", ["bin", "args", "output"]) |
| 27 | + |
| 28 | +# Since buildout's python.exe is really a script passed to the |
| 29 | +# system-installed Python, we need to get that same environment by starting |
| 30 | +# Python in the same manner. |
| 31 | +# Ex. ['c:\\Python27\\python.exe', 'C:\\u1\\bin\\python-script.py'] |
| 32 | +PYTHON = [_which_python()] |
| 33 | + |
| 34 | +def _find_bitrock(): |
| 35 | + with winreg.OpenKey(winreg.HKEY_LOCAL_MACHINE, |
| 36 | + r"Software\BitRock\BitRock InstallBuilder Professional", 0, |
| 37 | + winreg.KEY_READ | winreg.KEY_WOW64_32KEY) as key: |
| 38 | + path, reg_type = winreg.QueryValueEx(key, "Location") |
| 39 | + if reg_type != winreg.REG_SZ: |
| 40 | + raise Exception( |
| 41 | + "Got unexpected Location information: {}".format(reg_type)) |
| 42 | + return path if os.path.exists(path) else None |
| 43 | + |
| 44 | +def _find_output_dir(type): |
| 45 | + if os.getenv("JENKINS"): |
| 46 | + # On Jenkins, InstallBuilder goes straight to `output` while |
| 47 | + # AutoUpdate gets its own folder. Both of these folders are under |
| 48 | + # the BitRock installation. |
| 49 | + args = ["output"] |
| 50 | + if type == "AutoUpdate": |
| 51 | + args.insert(0, type) |
| 52 | + output = os.path.join(_find_bitrock(), *args) |
| 53 | + else: |
| 54 | + user_dir = os.getenv("USERPROFILE") |
| 55 | + if not user_dir: |
| 56 | + print("No USERPROFILE available") |
| 57 | + return None |
| 58 | + dir = "My Documents" if "Windows-2008" in platform() else "Documents" |
| 59 | + output = os.path.join(user_dir, dir, type, "output") |
| 60 | + return output if os.path.exists(output) else None |
| 61 | + |
| 62 | +def _get_last_file(dir): |
| 63 | + """Get the last written file in this directory. We just wrote it.""" |
| 64 | + files = os.listdir(dir) |
| 65 | + # Sort the files by modification time. |
| 66 | + files.sort(key=lambda f: os.stat(os.path.join(dir, f)).st_mtime) |
| 67 | + # We want the most recently modified, so take the last one. |
| 68 | + return os.path.join(dir, files[-1]) |
| 69 | + |
| 70 | +def setup_command(cmd): |
| 71 | + """Run a command through the setup.py script""" |
| 72 | + print("Calling", cmd) |
| 73 | + rv = subprocess.Popen(PYTHON + ["setup.py", cmd]).wait() |
| 74 | + if rv != 0: |
| 75 | + raise Exception("{} returned {}".format(cmd, rv)) |
| 76 | + print("{} returned {}".format(cmd, rv)) |
| 77 | + |
| 78 | +def bitrock_command(cmd, rename=False): |
| 79 | + """Run one of the BitRock binaries with some arguments""" |
| 80 | + |
| 81 | + if not cmd.output: |
| 82 | + raise Exception("Unable to find {} output".format(cmd.bin)) |
| 83 | + |
| 84 | + print("Running BitRock", cmd.bin) |
| 85 | + subprocess.check_output( |
| 86 | + [os.path.join(_find_bitrock(), cmd.bin)] + cmd.args, |
| 87 | + stderr=subprocess.STDOUT) |
| 88 | + |
| 89 | + source = _get_last_file(cmd.output) |
| 90 | + target = os.path.join(os.path.dirname(__file__) or os.getcwd(), |
| 91 | + os.path.basename(source)) |
| 92 | + |
| 93 | + # Copy the installer locally |
| 94 | + shutil.copy(source, target) |
| 95 | + if rename: |
| 96 | + orig_target = target |
| 97 | + # Rename the installer to be timestamped. |
| 98 | + root, ext = os.path.splitext(target) |
| 99 | + timestamp = time.strftime("%Y%m%d-%H%M%S", time.gmtime()) |
| 100 | + target = "{}-{}{}".format(root, timestamp, ext) |
| 101 | + os.rename(orig_target, target) |
| 102 | + print("Created", target) |
| 103 | + |
| 104 | +def main(): |
| 105 | + for cmd in ["fetch", "prepare", "py2exe"]: |
| 106 | + setup_command(cmd) |
| 107 | + |
| 108 | + autoupdate = BRCommand(os.path.join("autoupdate", "bin", "customize.exe"), |
| 109 | + ["build", "ubuntuone_autoupdate.xml", "windows"], |
| 110 | + _find_output_dir("AutoUpdate")) |
| 111 | + installer = BRCommand(os.path.join("bin", "builder-cli.exe"), |
| 112 | + ["build", "ubuntuone.xml"], |
| 113 | + _find_output_dir("InstallBuilder")) |
| 114 | + for cmd, rename in ((autoupdate, False), (installer, False)): |
| 115 | + bitrock_command(cmd, rename) |
| 116 | + |
| 117 | +if __name__ == "__main__": |
| 118 | + main() |
| 119 | + |
| 120 | |
| 121 | === added directory 'scripts/devsetup' |
| 122 | === added file 'scripts/devsetup/README.txt' |
| 123 | --- scripts/devsetup/README.txt 1970-01-01 00:00:00 +0000 |
| 124 | +++ scripts/devsetup/README.txt 2012-06-14 21:21:31 +0000 |
| 125 | @@ -0,0 +1,39 @@ |
| 126 | +Ubuntu One buildout |
| 127 | +=================== |
| 128 | + |
| 129 | +This is a buildout for Ubuntu One. It aims to provide the following |
| 130 | +when developing on windows (or in other Linuxes other than Ubuntu?): |
| 131 | + |
| 132 | +* A controlled set of dependencies for all our code |
| 133 | +* A mechanism to create a repeatable build for our windows releases |
| 134 | +* A simpler, more automated windows developer setup |
| 135 | + |
| 136 | +How Do I Use It |
| 137 | +=============== |
| 138 | + |
| 139 | +1. Get python 2.7 32 bits, get PyQt, get pywin32. |
| 140 | +2. Setup bazaar and your keys |
| 141 | +3. python bootstrap.py |
| 142 | + |
| 143 | +If you are on Windows, run "bin\buildout install windows" |
| 144 | +On other OSes, run "bin\buildout install development" |
| 145 | + |
| 146 | +At this point you should have a bin\python.exe which is a custom interpreter |
| 147 | +that can access all the required dependencies. If it fails installing |
| 148 | +logilab-something: try again. |
| 149 | + |
| 150 | +You should also have all the required scripts, like pep8, coverage and pylint, |
| 151 | +in the bin folder. |
| 152 | + |
| 153 | +5. bin\buildout install sources |
| 154 | + |
| 155 | +This will do a clean branch of all our relevant source code into the parts |
| 156 | +folder, so you can use it. As long as you use the custom python interpreter, |
| 157 | +everything should just work as you are used to. If it doesn't let me know |
| 158 | +at roberto.alsina@canonical.com |
| 159 | + |
| 160 | +6. On Windows, running "env.bat" will put the "bin\python.exe" which |
| 161 | +buildout created into the Path. It will also gather necessary scripts |
| 162 | +from the buildout and place them in the bin folder as needed. Now your |
| 163 | +tests should be able to use this Python in this buildout and work without |
| 164 | +needed anything installed into your system's Python installation. |
| 165 | |
| 166 | === added file 'scripts/devsetup/bootstrap.py' |
| 167 | --- scripts/devsetup/bootstrap.py 1970-01-01 00:00:00 +0000 |
| 168 | +++ scripts/devsetup/bootstrap.py 2012-06-14 21:21:31 +0000 |
| 169 | @@ -0,0 +1,262 @@ |
| 170 | +############################################################################## |
| 171 | +# |
| 172 | +# Copyright (c) 2006 Zope Foundation and Contributors. |
| 173 | +# All Rights Reserved. |
| 174 | +# |
| 175 | +# This software is subject to the provisions of the Zope Public License, |
| 176 | +# Version 2.1 (ZPL). A copy of the ZPL should accompany this distribution. |
| 177 | +# THIS SOFTWARE IS PROVIDED "AS IS" AND ANY AND ALL EXPRESS OR IMPLIED |
| 178 | +# WARRANTIES ARE DISCLAIMED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED |
| 179 | +# WARRANTIES OF TITLE, MERCHANTABILITY, AGAINST INFRINGEMENT, AND FITNESS |
| 180 | +# FOR A PARTICULAR PURPOSE. |
| 181 | +# |
| 182 | +############################################################################## |
| 183 | +"""Bootstrap a buildout-based project |
| 184 | + |
| 185 | +Simply run this script in a directory containing a buildout.cfg. |
| 186 | +The script accepts buildout command-line options, so you can |
| 187 | +use the -c option to specify an alternate configuration file. |
| 188 | +""" |
| 189 | + |
| 190 | +import os, shutil, sys, tempfile, urllib, urllib2, subprocess |
| 191 | +from optparse import OptionParser |
| 192 | + |
| 193 | +if sys.platform == 'win32': |
| 194 | + def quote(c): |
| 195 | + if ' ' in c: |
| 196 | + return '"%s"' % c # work around spawn lamosity on windows |
| 197 | + else: |
| 198 | + return c |
| 199 | +else: |
| 200 | + quote = str |
| 201 | + |
| 202 | +# See zc.buildout.easy_install._has_broken_dash_S for motivation and comments. |
| 203 | +stdout, stderr = subprocess.Popen( |
| 204 | + [sys.executable, '-Sc', |
| 205 | + 'try:\n' |
| 206 | + ' import ConfigParser\n' |
| 207 | + 'except ImportError:\n' |
| 208 | + ' print 1\n' |
| 209 | + 'else:\n' |
| 210 | + ' print 0\n'], |
| 211 | + stdout=subprocess.PIPE, stderr=subprocess.PIPE).communicate() |
| 212 | +has_broken_dash_S = bool(int(stdout.strip())) |
| 213 | + |
| 214 | +# In order to be more robust in the face of system Pythons, we want to |
| 215 | +# run without site-packages loaded. This is somewhat tricky, in |
| 216 | +# particular because Python 2.6's distutils imports site, so starting |
| 217 | +# with the -S flag is not sufficient. However, we'll start with that: |
| 218 | +if not has_broken_dash_S and 'site' in sys.modules: |
| 219 | + # We will restart with python -S. |
| 220 | + args = sys.argv[:] |
| 221 | + args[0:0] = [sys.executable, '-S'] |
| 222 | + args = map(quote, args) |
| 223 | + os.execv(sys.executable, args) |
| 224 | +# Now we are running with -S. We'll get the clean sys.path, import site |
| 225 | +# because distutils will do it later, and then reset the path and clean |
| 226 | +# out any namespace packages from site-packages that might have been |
| 227 | +# loaded by .pth files. |
| 228 | +clean_path = sys.path[:] |
| 229 | +import site # imported because of its side effects |
| 230 | +sys.path[:] = clean_path |
| 231 | +for k, v in sys.modules.items(): |
| 232 | + if k in ('setuptools', 'pkg_resources') or ( |
| 233 | + hasattr(v, '__path__') and |
| 234 | + len(v.__path__) == 1 and |
| 235 | + not os.path.exists(os.path.join(v.__path__[0], '__init__.py'))): |
| 236 | + # This is a namespace package. Remove it. |
| 237 | + sys.modules.pop(k) |
| 238 | + |
| 239 | +is_jython = sys.platform.startswith('java') |
| 240 | + |
| 241 | +setuptools_source = 'http://peak.telecommunity.com/dist/ez_setup.py' |
| 242 | +distribute_source = 'http://python-distribute.org/distribute_setup.py' |
| 243 | + |
| 244 | + |
| 245 | +# parsing arguments |
| 246 | +def normalize_to_url(option, opt_str, value, parser): |
| 247 | + if value: |
| 248 | + if '://' not in value: # It doesn't smell like a URL. |
| 249 | + value = 'file://%s' % ( |
| 250 | + urllib.pathname2url( |
| 251 | + os.path.abspath(os.path.expanduser(value))),) |
| 252 | + if opt_str == '--download-base' and not value.endswith('/'): |
| 253 | + # Download base needs a trailing slash to make the world happy. |
| 254 | + value += '/' |
| 255 | + else: |
| 256 | + value = None |
| 257 | + name = opt_str[2:].replace('-', '_') |
| 258 | + setattr(parser.values, name, value) |
| 259 | + |
| 260 | +usage = '''\ |
| 261 | +[DESIRED PYTHON FOR BUILDOUT] bootstrap.py [options] |
| 262 | + |
| 263 | +Bootstraps a buildout-based project. |
| 264 | + |
| 265 | +Simply run this script in a directory containing a buildout.cfg, using the |
| 266 | +Python that you want bin/buildout to use. |
| 267 | + |
| 268 | +Note that by using --setup-source and --download-base to point to |
| 269 | +local resources, you can keep this script from going over the network. |
| 270 | +''' |
| 271 | + |
| 272 | +parser = OptionParser(usage=usage) |
| 273 | +parser.add_option("-v", "--version", dest="version", |
| 274 | + help="use a specific zc.buildout version") |
| 275 | +parser.add_option("-d", "--distribute", |
| 276 | + action="store_true", dest="use_distribute", default=False, |
| 277 | + help="Use Distribute rather than Setuptools.") |
| 278 | +parser.add_option("--setup-source", action="callback", dest="setup_source", |
| 279 | + callback=normalize_to_url, nargs=1, type="string", |
| 280 | + help=("Specify a URL or file location for the setup file. " |
| 281 | + "If you use Setuptools, this will default to " + |
| 282 | + setuptools_source + "; if you use Distribute, this " |
| 283 | + "will default to " + distribute_source + ".")) |
| 284 | +parser.add_option("--download-base", action="callback", dest="download_base", |
| 285 | + callback=normalize_to_url, nargs=1, type="string", |
| 286 | + help=("Specify a URL or directory for downloading " |
| 287 | + "zc.buildout and either Setuptools or Distribute. " |
| 288 | + "Defaults to PyPI.")) |
| 289 | +parser.add_option("--eggs", |
| 290 | + help=("Specify a directory for storing eggs. Defaults to " |
| 291 | + "a temporary directory that is deleted when the " |
| 292 | + "bootstrap script completes.")) |
| 293 | +parser.add_option("-t", "--accept-buildout-test-releases", |
| 294 | + dest='accept_buildout_test_releases', |
| 295 | + action="store_true", default=False, |
| 296 | + help=("Normally, if you do not specify a --version, the " |
| 297 | + "bootstrap script and buildout gets the newest " |
| 298 | + "*final* versions of zc.buildout and its recipes and " |
| 299 | + "extensions for you. If you use this flag, " |
| 300 | + "bootstrap and buildout will get the newest releases " |
| 301 | + "even if they are alphas or betas.")) |
| 302 | +parser.add_option("-c", None, action="store", dest="config_file", |
| 303 | + help=("Specify the path to the buildout configuration " |
| 304 | + "file to be used.")) |
| 305 | + |
| 306 | +options, args = parser.parse_args() |
| 307 | + |
| 308 | +# if -c was provided, we push it back into args for buildout's main function |
| 309 | +if options.config_file is not None: |
| 310 | + args += ['-c', options.config_file] |
| 311 | + |
| 312 | +if options.eggs: |
| 313 | + eggs_dir = os.path.abspath(os.path.expanduser(options.eggs)) |
| 314 | +else: |
| 315 | + eggs_dir = tempfile.mkdtemp() |
| 316 | + |
| 317 | +if options.setup_source is None: |
| 318 | + if options.use_distribute: |
| 319 | + options.setup_source = distribute_source |
| 320 | + else: |
| 321 | + options.setup_source = setuptools_source |
| 322 | + |
| 323 | +if options.accept_buildout_test_releases: |
| 324 | + args.append('buildout:accept-buildout-test-releases=true') |
| 325 | +args.append('bootstrap') |
| 326 | + |
| 327 | +try: |
| 328 | + import pkg_resources |
| 329 | + import setuptools # A flag. Sometimes pkg_resources is installed alone. |
| 330 | + if not hasattr(pkg_resources, '_distribute'): |
| 331 | + raise ImportError |
| 332 | +except ImportError: |
| 333 | + ez_code = urllib2.urlopen( |
| 334 | + options.setup_source).read().replace('\r\n', '\n') |
| 335 | + ez = {} |
| 336 | + exec ez_code in ez |
| 337 | + setup_args = dict(to_dir=eggs_dir, download_delay=0) |
| 338 | + if options.download_base: |
| 339 | + setup_args['download_base'] = options.download_base |
| 340 | + if options.use_distribute: |
| 341 | + setup_args['no_fake'] = True |
| 342 | + ez['use_setuptools'](**setup_args) |
| 343 | + if 'pkg_resources' in sys.modules: |
| 344 | + reload(sys.modules['pkg_resources']) |
| 345 | + import pkg_resources |
| 346 | + # This does not (always?) update the default working set. We will |
| 347 | + # do it. |
| 348 | + for path in sys.path: |
| 349 | + if path not in pkg_resources.working_set.entries: |
| 350 | + pkg_resources.working_set.add_entry(path) |
| 351 | + |
| 352 | +cmd = [quote(sys.executable), |
| 353 | + '-c', |
| 354 | + quote('from setuptools.command.easy_install import main; main()'), |
| 355 | + '-mqNxd', |
| 356 | + quote(eggs_dir)] |
| 357 | + |
| 358 | +if not has_broken_dash_S: |
| 359 | + cmd.insert(1, '-S') |
| 360 | + |
| 361 | +find_links = options.download_base |
| 362 | +if not find_links: |
| 363 | + find_links = os.environ.get('bootstrap-testing-find-links') |
| 364 | +if find_links: |
| 365 | + cmd.extend(['-f', quote(find_links)]) |
| 366 | + |
| 367 | +if options.use_distribute: |
| 368 | + setup_requirement = 'distribute' |
| 369 | +else: |
| 370 | + setup_requirement = 'setuptools' |
| 371 | +ws = pkg_resources.working_set |
| 372 | +setup_requirement_path = ws.find( |
| 373 | + pkg_resources.Requirement.parse(setup_requirement)).location |
| 374 | +env = dict( |
| 375 | + os.environ, |
| 376 | + PYTHONPATH=setup_requirement_path) |
| 377 | + |
| 378 | +requirement = 'zc.buildout' |
| 379 | +version = options.version |
| 380 | +if version is None and not options.accept_buildout_test_releases: |
| 381 | + # Figure out the most recent final version of zc.buildout. |
| 382 | + import setuptools.package_index |
| 383 | + _final_parts = '*final-', '*final' |
| 384 | + |
| 385 | + def _final_version(parsed_version): |
| 386 | + for part in parsed_version: |
| 387 | + if (part[:1] == '*') and (part not in _final_parts): |
| 388 | + return False |
| 389 | + return True |
| 390 | + index = setuptools.package_index.PackageIndex( |
| 391 | + search_path=[setup_requirement_path]) |
| 392 | + if find_links: |
| 393 | + index.add_find_links((find_links,)) |
| 394 | + req = pkg_resources.Requirement.parse(requirement) |
| 395 | + if index.obtain(req) is not None: |
| 396 | + best = [] |
| 397 | + bestv = None |
| 398 | + for dist in index[req.project_name]: |
| 399 | + distv = dist.parsed_version |
| 400 | + if _final_version(distv): |
| 401 | + if bestv is None or distv > bestv: |
| 402 | + best = [dist] |
| 403 | + bestv = distv |
| 404 | + elif distv == bestv: |
| 405 | + best.append(dist) |
| 406 | + if best: |
| 407 | + best.sort() |
| 408 | + version = best[-1].version |
| 409 | +if version: |
| 410 | + requirement = '=='.join((requirement, version)) |
| 411 | +cmd.append(requirement) |
| 412 | + |
| 413 | +if is_jython: |
| 414 | + import subprocess |
| 415 | + exitcode = subprocess.Popen(cmd, env=env).wait() |
| 416 | +else: # Windows prefers this, apparently; otherwise we would prefer subprocess |
| 417 | + exitcode = os.spawnle(*([os.P_WAIT, sys.executable] + cmd + [env])) |
| 418 | +if exitcode != 0: |
| 419 | + sys.stdout.flush() |
| 420 | + sys.stderr.flush() |
| 421 | + print ("An error occurred when trying to install zc.buildout. " |
| 422 | + "Look above this message for any errors that " |
| 423 | + "were output by easy_install.") |
| 424 | + sys.exit(exitcode) |
| 425 | + |
| 426 | +ws.add_entry(eggs_dir) |
| 427 | +ws.require(requirement) |
| 428 | +import zc.buildout.buildout |
| 429 | +zc.buildout.buildout.main(args) |
| 430 | +if not options.eggs: # clean up temporary egg directory |
| 431 | + shutil.rmtree(eggs_dir) |
| 432 | |
| 433 | === added file 'scripts/devsetup/buildout.cfg' |
| 434 | --- scripts/devsetup/buildout.cfg 1970-01-01 00:00:00 +0000 |
| 435 | +++ scripts/devsetup/buildout.cfg 2012-06-14 21:21:31 +0000 |
| 436 | @@ -0,0 +1,98 @@ |
| 437 | +[buildout] |
| 438 | +parts = |
| 439 | + development |
| 440 | + windows |
| 441 | + |
| 442 | +find-links = |
| 443 | + https://github.com/ghtdak/qtreactor/tarball/master#egg=qt4reactor |
| 444 | + http://launchpad.net/python-distutils-extra/trunk/2.31/+download/python-distutils-extra-2.31.tar.gz#egg=python-distutils-extra |
| 445 | +# Mandel's patched keyring, already built |
| 446 | + http://u1.to/ralsina/L/keyring-0.7-py2.7.egg#egg=keyring |
| 447 | +# Pycrypto already built using python -c "import setuptools; execfile('setup.py')" bdist_egg |
| 448 | + http://u1.to/ralsina/P/pycrypto-2.4.1-py2.7-win32.egg#egg=pycrypto |
| 449 | +# Py2exe already build using python -c "import setuptools; execfile('setup.py')" bdist_egg |
| 450 | + http://u1.to/ralsina/x/py2exe-0.6.9-py2.7-win32.egg#egg=py2exe |
| 451 | +# Protobuf's upstream zip file doesn't work via easy_install so using an egg. |
| 452 | + http://u1.to/ralsina/G/protobuf-2.4.1-py2.7.egg#egg=protobuf |
| 453 | +# Comtypes has a bug in setup.py with Python 2.7, so this should be changed eventually |
| 454 | +# http://sourceforge.net/tracker/index.php?func=detail&aid=3036368&group_id=115265&atid=692940 |
| 455 | + http://u1.to/ralsina/w/comtypes-0.6.2.zip#egg=comtypes |
| 456 | + http://launchpad.net/configglue/trunk/1.0/+download/configglue-1.0.tar.gz#egg=configglue |
| 457 | + http://launchpad.net/ubuntuone-dev-tools/stable-3-0/3.0.0/+download/ubuntuone-dev-tools-3.0.0.tar.gz#egg=ubuntuone-dev-tools |
| 458 | + http://launchpad.net/dirspec/stable-3-0/3.0.0/+download/dirspec-3.0.0.tar.gz#egg=dirspec |
| 459 | + http://u1.to/ralsina/7/Twisted-11.1.0-py2.7-win32.egg#egg=twisted |
| 460 | +unzip = true |
| 461 | +newest = false |
| 462 | +versions = versions |
| 463 | + |
| 464 | +[windows] |
| 465 | +recipe = zc.recipe.egg:scripts |
| 466 | +versions = versions |
| 467 | +eggs = |
| 468 | + py2exe |
| 469 | + comtypes |
| 470 | +# Include the common [development] eggs |
| 471 | + ${development:eggs} |
| 472 | +interpreter = python |
| 473 | + |
| 474 | +[development] |
| 475 | +recipe = zc.recipe.egg:scripts |
| 476 | +eggs = |
| 477 | + twisted |
| 478 | + qt4reactor |
| 479 | + python-distutils-extra |
| 480 | + keyring |
| 481 | + pycrypto |
| 482 | + lazr.restfulclient |
| 483 | + pyOpenSSL |
| 484 | + pil |
| 485 | + httplib2 |
| 486 | + protobuf |
| 487 | + configglue |
| 488 | + logilab-astng |
| 489 | + logilab-common |
| 490 | + mocker |
| 491 | + coverage |
| 492 | + pylint |
| 493 | + pyflakes |
| 494 | + pep8 |
| 495 | + ubuntuone-dev-tools |
| 496 | + dirspec |
| 497 | + oauth |
| 498 | + simplejson |
| 499 | +versions = versions |
| 500 | +interpreter = python |
| 501 | + |
| 502 | +[versions] |
| 503 | +twisted = 11.1.0 |
| 504 | +# qt4reactor does not go in here. Specifying the github link covers it. |
| 505 | +python-distutils-extra = 2.31 |
| 506 | +keyring = 0.7 |
| 507 | +pycrypto = 2.4.1 |
| 508 | +lazr.restfulclient = 0.12.0 |
| 509 | +pyOpenSSL = 0.13 |
| 510 | +pil = 1.1.7 |
| 511 | +httplib2 = 0.7.2 |
| 512 | +protobuf = 2.4.1 |
| 513 | +configglue = 1.0.0 |
| 514 | +logilab-astng = 0.23.1 |
| 515 | +logilab-common = 0.57.1 |
| 516 | +mocker = 1.1 |
| 517 | +coverage = 3.5.1 |
| 518 | +pylint = 0.25.1 |
| 519 | +pyflakes = 0.5.0 |
| 520 | +pep8 = 1.1 |
| 521 | +ubuntuone-dev-tools = 3.0.0 |
| 522 | +dirspec = 3.0.0 |
| 523 | +oauth = 1.0.1 |
| 524 | +py2exe = 0.6.9 |
| 525 | +comtypes = 0.6.2 |
| 526 | + |
| 527 | +[sources] |
| 528 | +recipe = bazaarrecipeinfrae |
| 529 | +urls = |
| 530 | + lp:ubuntuone-client ubuntuone-client |
| 531 | + lp:ubuntu-sso-client ubuntu-sso-client |
| 532 | + lp:ubuntuone-storage-protocol ubuntuone-storage-protocol |
| 533 | + lp:ubuntuone-control-panel ubuntuone-control-panel |
| 534 | + lp:ubuntuone-windows-installer ubuntuone-windows-installer |
| 535 | |
| 536 | === added file 'scripts/devsetup/env.bat' |
| 537 | --- scripts/devsetup/env.bat 1970-01-01 00:00:00 +0000 |
| 538 | +++ scripts/devsetup/env.bat 2012-06-14 21:21:31 +0000 |
| 539 | @@ -0,0 +1,79 @@ |
| 540 | +@echo off |
| 541 | + |
| 542 | +:: for jenkins |
| 543 | +cd %~dp0 |
| 544 | + |
| 545 | +SET PYTHONPATHTOKENS=3 |
| 546 | +VER | FIND "XP" > nul |
| 547 | +IF %ERRORLEVEL% == 0 SET PYTHONPATHTOKENS=4 |
| 548 | + |
| 549 | +echo Adding bin folder to Path |
| 550 | +set Path=%CD%\bin;%Path% |
| 551 | + |
| 552 | +:: Get protoc.exe for ubuntuone-storage-protocol building |
| 553 | +:: This will use the Python on the Path that we got from Buildout |
| 554 | +python.exe get_protoc.py |
| 555 | + |
| 556 | + |
| 557 | +FOR /F "tokens=*" %%A IN ('python -c "import sys;print [dir for dir in sys.path if \"ubuntuone_dev_tools\" in dir][0]"') DO SET DEVTOOLS=%%A |
| 558 | +FOR /F "tokens=*" %%A IN ('python -c "import sys;print [dir for dir in sys.path if \"pylint\" in dir][0]"') DO SET PYLINT=%%A |
| 559 | +FOR /F "tokens=*" %%A IN ('python -c "import sys;print [dir for dir in sys.path if \"pyflakes\" in dir][0]"') DO SET PYFLAKES=%%A |
| 560 | + |
| 561 | +IF EXIST "%~dp0bin\u1trial" GOTO TRIALALREADY |
| 562 | +echo Copying u1trial to bin |
| 563 | +copy %DEVTOOLS%\EGG-INFO\scripts\u1trial bin |
| 564 | +copy %DEVTOOLS%\EGG-INFO\scripts\u1trial.bat bin |
| 565 | +:TRIALALREADY |
| 566 | + |
| 567 | +IF EXIST "%~dp0bin\u1lint" GOTO LINTALREADY |
| 568 | +echo Copying u1lint to bin |
| 569 | +copy %DEVTOOLS%\EGG-INFO\scripts\u1lint bin |
| 570 | +copy %DEVTOOLS%\EGG-INFO\scripts\u1lint.bat bin |
| 571 | +:LINTALREADY |
| 572 | + |
| 573 | +IF EXIST "%~dp0bin\pylint" GOTO PYLINTALREADY |
| 574 | +echo Copying pylint to bin |
| 575 | +copy %PYLINT%\EGG-INFO\scripts\pylint bin |
| 576 | +copy %PYLINT%\\EGG-INFO\scripts\pylint.bat bin |
| 577 | +:PYLINTALREADY |
| 578 | + |
| 579 | +IF EXIST "%~dp0bin\pyflakes" GOTO PYFLAKESALREADY |
| 580 | +echo Copying pyflakes to bin |
| 581 | +copy %PYFLAKES%\pyflakes\scripts\pyflakes.py bin\pyflakes |
| 582 | +:PYFLAKESALREADY |
| 583 | + |
| 584 | +:: Running ubuntuone-control-panel tests requires -protocol to be built |
| 585 | +IF EXIST "%~dp0parts\ubuntuone-storage-protocol\build" GOTO PROTOCOLBUILT |
| 586 | +echo Building ubuntuone-storage-protocol |
| 587 | +cd parts\ubuntuone-storage-protocol |
| 588 | +python.exe setup.py install |
| 589 | +cd %~dp0 |
| 590 | +:PROTOCOLBUILT |
| 591 | + |
| 592 | + |
| 593 | + |
| 594 | +:: Run all tests |
| 595 | +IF NOT "%1" == "testall" GOTO END |
| 596 | + |
| 597 | +cd parts\ubuntu-sso-client |
| 598 | +:: Check for one of the expected reg values and install the value if we don't find it. |
| 599 | +FOR /F "tokens=%PYTHONPATHTOKENS%" %%A IN ('REG QUERY "HKEY_LOCAL_MACHINE\SOFTWARE\Ubuntu One" /v path-ubuntuone-syncdaemon') DO SET SYNCDAEMON=%%A |
| 600 | +IF NOT %errorlevel% == 0 ubuntu_sso\main\tests\ubuntuone.reg |
| 601 | + |
| 602 | +CALL run-tests.bat |
| 603 | +cd "%~dp0" |
| 604 | + |
| 605 | +cd parts\ubuntuone-client |
| 606 | +CALL run-tests.bat |
| 607 | +cd "%~dp0" |
| 608 | + |
| 609 | +cd parts\ubuntuone-control-panel |
| 610 | +CALL run-tests.bat |
| 611 | +cd "%~dp0" |
| 612 | + |
| 613 | +cd parts\ubuntuone-windows-installer |
| 614 | +CALL run-tests.bat |
| 615 | +cd "%~dp0" |
| 616 | + |
| 617 | +:END |
| 618 | + |
| 619 | |
| 620 | === added file 'scripts/devsetup/get_protoc.py' |
| 621 | --- scripts/devsetup/get_protoc.py 1970-01-01 00:00:00 +0000 |
| 622 | +++ scripts/devsetup/get_protoc.py 2012-06-14 21:21:31 +0000 |
| 623 | @@ -0,0 +1,33 @@ |
| 624 | +import sys |
| 625 | +import subprocess |
| 626 | +import shlex |
| 627 | +import os |
| 628 | +import urllib |
| 629 | +import tempfile |
| 630 | +import zipfile |
| 631 | + |
| 632 | +URL = "http://protobuf.googlecode.com/files/protoc-2.4.1-win32.zip" |
| 633 | + |
| 634 | +def get_protoc(): |
| 635 | + response = urllib.urlopen(URL) |
| 636 | + data = response.read() |
| 637 | + if not data: |
| 638 | + raise Exception("Unable to download %s" % URL) |
| 639 | + |
| 640 | + fd, name = tempfile.mkstemp() |
| 641 | + |
| 642 | + with os.fdopen(fd, "w") as f: |
| 643 | + f.write(data) |
| 644 | + with zipfile.ZipFile(name) as zf: |
| 645 | + path = zf.extract("protoc.exe", "bin") |
| 646 | + return path |
| 647 | + |
| 648 | +def _main(): |
| 649 | + bin_dir = os.path.join(os.getcwd(), "bin") |
| 650 | + if not os.path.exists(os.path.join(bin_dir, "protoc.exe")): |
| 651 | + path = get_protoc() |
| 652 | + print "Protobuf compiler installed to %s" % path |
| 653 | + |
| 654 | +if __name__ == "__main__": |
| 655 | + sys.exit(_main()) |
| 656 | + |
| 657 | |
| 658 | === added file 'scripts/devsetup/updateall.bat' |
| 659 | --- scripts/devsetup/updateall.bat 1970-01-01 00:00:00 +0000 |
| 660 | +++ scripts/devsetup/updateall.bat 2012-06-14 21:21:31 +0000 |
| 661 | @@ -0,0 +1,23 @@ |
| 662 | +@echo off |
| 663 | + |
| 664 | +cd %1\ubuntu-sso-client |
| 665 | +bzr pull |
| 666 | +cd %~dp0 |
| 667 | + |
| 668 | +cd %1\ubuntuone-client |
| 669 | +bzr pull |
| 670 | +cd %~dp0 |
| 671 | + |
| 672 | +cd %1\ubuntuone-control-panel |
| 673 | +bzr pull |
| 674 | +cd %~dp0 |
| 675 | + |
| 676 | +cd %1\ubuntuone-storage-protocol |
| 677 | +bzr pull |
| 678 | +cd %~dp0 |
| 679 | + |
| 680 | +cd %1\ubuntuone-windows-installer |
| 681 | +bzr pull |
| 682 | +cd %~dp0 |
| 683 | + |
| 684 | +cd %~dp0 |
| 685 | |
| 686 | === modified file 'scripts/setup.py' |
| 687 | --- scripts/setup.py 2012-05-21 13:45:41 +0000 |
| 688 | +++ scripts/setup.py 2012-06-14 21:21:31 +0000 |
| 689 | @@ -20,10 +20,12 @@ |
| 690 | import shutil |
| 691 | import subprocess |
| 692 | import sys |
| 693 | +import urllib |
| 694 | |
| 695 | from distutils import log |
| 696 | from distutils.cmd import Command |
| 697 | from distutils.core import setup |
| 698 | +from glob import glob |
| 699 | |
| 700 | import conf |
| 701 | |
| 702 | @@ -265,6 +267,10 @@ |
| 703 | "ubuntuone-storage-protocol", "data", |
| 704 | "UbuntuOne-Go_Daddy_Class_2_CA.pem"), |
| 705 | os.path.join("data", "UbuntuOne-Go_Daddy_Class_2_CA.pem")) |
| 706 | + shutil.copyfile(os.path.join("sources", |
| 707 | + "ubuntuone-storage-protocol", "data", |
| 708 | + "ValiCert_Class_2_VA.pem"), |
| 709 | + os.path.join("data", "ValiCert_Class_2_VA.pem")) |
| 710 | |
| 711 | # Copy syncdaemon config data |
| 712 | shutil.copyfile(os.path.join("sources", |
| 713 | @@ -293,6 +299,9 @@ |
| 714 | { |
| 715 | 'script': 'bin/u1sdtool', |
| 716 | }, |
| 717 | + { |
| 718 | + 'script': 'bin/ubuntuone-proxy-tunnel', |
| 719 | + }, |
| 720 | ] |
| 721 | |
| 722 | windows = [ |
| 723 | @@ -301,10 +310,6 @@ |
| 724 | 'icon_resources': [(0, 'ubuntu_one.ico')] |
| 725 | }, |
| 726 | { |
| 727 | - 'script': 'bin/ubuntuone-proxy-tunnel', |
| 728 | - 'icon_resources': [(0, 'ubuntu_one.ico')] |
| 729 | - }, |
| 730 | - { |
| 731 | 'script': 'bin/ubuntuone-control-panel-qt', |
| 732 | 'icon_resources': [(0, 'ubuntu_one.ico')] |
| 733 | }, |
| 734 | @@ -330,6 +335,33 @@ |
| 735 | console.extend(windows) |
| 736 | windows = [] |
| 737 | |
| 738 | + # From http://www.py2exe.org/index.cgi/Tutorial#Step521 |
| 739 | + # Bundle our own copy of the CRT so we don't need to depend on the |
| 740 | + # vcredist_x86.exe for automation, or as a step of installer. |
| 741 | + data_files = [("Microsoft.VC90.CRT", |
| 742 | + glob(r"C:\Program Files (x86)" |
| 743 | + r"\Microsoft Visual Studio 9.0\vc\redist" |
| 744 | + r"\x86\Microsoft.VC90.CRT\*.*"))] |
| 745 | + |
| 746 | + if not os.path.exists("dist"): |
| 747 | + os.mkdir("dist") |
| 748 | + |
| 749 | + # The VistaLib license requires that we distribute this file. |
| 750 | + shutil.copy("README_nonelevated.txt", "dist") |
| 751 | + |
| 752 | + vistalib32 = "http://ubuntuone.com/2jcKAeBwIw8joW8mEu5JYX" |
| 753 | + vistalib64 = "http://ubuntuone.com/16h3eDF4NPCLIUFJeBYxxc" |
| 754 | + |
| 755 | + for url, name in ((vistalib32, "VistaLib32.dll"), |
| 756 | + (vistalib64, "VistaLib64.dll")): |
| 757 | + response = urllib.urlopen(url) |
| 758 | + data = response.read() |
| 759 | + if not data: |
| 760 | + raise Exception("Unable to download %s" % URL) |
| 761 | + |
| 762 | + with open(os.path.join("dist", name), "wb") as f: |
| 763 | + f.write(data) |
| 764 | + |
| 765 | # Build bundles |
| 766 | setup( |
| 767 | name='ubuntuone', |
| 768 | @@ -346,6 +378,7 @@ |
| 769 | }, |
| 770 | console=console, |
| 771 | windows=windows, |
| 772 | + data_files=data_files, |
| 773 | options={ |
| 774 | 'py2exe': { |
| 775 | 'includes': ['google.protobuf.descriptor', |
| 776 | |
| 777 | === modified file 'scripts/ubuntuone.xml' |
| 778 | --- scripts/ubuntuone.xml 2012-05-21 13:45:41 +0000 |
| 779 | +++ scripts/ubuntuone.xml 2012-06-14 21:21:31 +0000 |
| 780 | @@ -94,9 +94,6 @@ |
| 781 | <origin>data</origin> |
| 782 | </distributionDirectory> |
| 783 | <distributionFile> |
| 784 | - <origin>vcredist_x86.exe</origin> |
| 785 | - </distributionFile> |
| 786 | - <distributionFile> |
| 787 | <origin>ubuntu_one.ico</origin> |
| 788 | </distributionFile> |
| 789 | </distributionFileList> |
| 790 | @@ -151,34 +148,6 @@ |
| 791 | </startMenuFileShortcut> |
| 792 | </startMenuShortcutList> |
| 793 | </component> |
| 794 | - <component> |
| 795 | - <name>vcruntime</name> |
| 796 | - <canBeEdited>1</canBeEdited> |
| 797 | - <selected>1</selected> |
| 798 | - <show>1</show> |
| 799 | - <folderList> |
| 800 | - <folder> |
| 801 | - <destination>${installdir}</destination> |
| 802 | - <name>vcfiles</name> |
| 803 | - <platforms>all</platforms> |
| 804 | - <actionList> |
| 805 | - <runProgram> |
| 806 | - <abortOnError>0</abortOnError> |
| 807 | - <program>${installdir}/vcredist_x86.exe</program> |
| 808 | - <programArguments>/q |
| 809 | -</programArguments> |
| 810 | - <progressText>Installing C++ runtime</progressText> |
| 811 | - <showMessageOnError>0</showMessageOnError> |
| 812 | - </runProgram> |
| 813 | - </actionList> |
| 814 | - <distributionFileList> |
| 815 | - <distributionFile> |
| 816 | - <origin>vcredist_x86.exe</origin> |
| 817 | - </distributionFile> |
| 818 | - </distributionFileList> |
| 819 | - </folder> |
| 820 | - </folderList> |
| 821 | - </component> |
| 822 | </componentList> |
| 823 | <initializationActionList> |
| 824 | <setInstallerVariable name="msiexec" value=""/> |
| 825 | @@ -327,6 +296,10 @@ |
| 826 | <destination>${windows_folder_common_appdata}\ubuntuone-storageprotocol</destination> |
| 827 | <origin>${installdir}\data\UbuntuOne-Go_Daddy_Class_2_CA.pem</origin> |
| 828 | </copyFile> |
| 829 | + <copyFile> |
| 830 | + <destination>${windows_folder_common_appdata}\ubuntuone-storageprotocol</destination> |
| 831 | + <origin>${installdir}\data\ValiCert_Class_2_VA.pem</origin> |
| 832 | + </copyFile> |
| 833 | <deleteFile> |
| 834 | <path>c:\install.exe</path> |
| 835 | </deleteFile> |
