Project

Profile

Help

Revision feed0779

IDfeed0779104f93ab2f7e8956fdc29ee1d25c9c55
Parent 7efcc006
Child 1f0e117b

Added by Vincent Le Goff 2 months ago

Bring #153: add a fake updater to test update stability

View differences:

src/dbg_updater.py
32 32

  
33 33
"""
34 34

  
35
import argparse
35 36
import os
36 37

  
37 38
from autoupdate import AutoUpdate
38 39
from version import BUILD
39 40

  
41
parser = argparse.ArgumentParser()
42
parser.add_argument("-z", "--zip", action="store_true",
43
        help="Update from a build.zip file instead of downloading the update")
44
args = parser.parse_args()
45

  
40 46
autoupdate = AutoUpdate(BUILD, None)
41
print("Checking for updates...")
42
build = autoupdate.check()
43
if build is not None:
44
    print("A new update is available: {}.\n".format(build))
45
    autoupdate.download(stdout=True)
46
    autoupdate.update(stdout=True)
47
if args.zip:
48
    archive = "updating/build.zip"
49
    if not os.path.exists(archive):
50
        print(f"The archived build {archive!r} couldn't be found.")
51
    else:
52
        autoupdate.path_archive = archive
53
        autoupdate.update(stdout=True)
47 54
else:
48
    print("No update is available, but download anyway.")
49
    autoupdate.download(stdout=True)
50
    autoupdate.update(stdout=True)
55
    print("Checking for updates...")
56
    build = autoupdate.check()
57
    if build is not None:
58
        print("A new update is available: {}.\n".format(build))
59
        autoupdate.download(stdout=True)
60
        autoupdate.update(stdout=True)
61
    else:
62
        print("No update is available, but download anyway.")
63
        autoupdate.download(stdout=True)
64
        autoupdate.update(stdout=True)
51 65

  
52
os.system("pause")
66
    os.system("pause")
src/setup.py
50 50
distutils_path = os.path.join(os.path.dirname(opcode.__file__), 'distutils')
51 51
includefiles = [
52 52
    (distutils_path, 'lib/distutils'),
53
    # The 'pubsub' package has to be copied from the virtual environment
54
    (os.path.join(os.environ["VIRTUAL_ENV"], 'lib', 'site-packages', 'pubsub', 'utils'), 'lib/pubsub/utils'),
53 55
    "translations",
54 56
    "worlds",
55 57
    "../doc",
tools/update_license.py
12 12
        content = file.read()
13 13

  
14 14
    content = HEADER.sub("Copyright (c) 2016-2020,", content)
15
    with path.open("w", encoding="utf-8") as file:
16
        file.write(content)
15
    with path.open("wb") as file:
16
        file.write(content.encode("utf-8"))
17 17
    print(f"Writing in {path}...")

Also available in: Unified diff