예제 #1
0
# DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
# SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
# CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
# OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

"""This file contains the debug updater.

It's a console updater that plans on updating CocoMUD client.

"""

import os

from autoupdate import AutoUpdate
from version import BUILD

autoupdate = AutoUpdate(BUILD, None)
print "Checking for updates..."
build = autoupdate.check()
if build is not None:
    print "A new update is available: {}.\n".format(build)
    autoupdate.download(stdout=True)
    autoupdate.update(stdout=True)
else:
    print "No update is available, but download anyway."
    autoupdate.download(stdout=True)
    autoupdate.update(stdout=True)

os.system("pause")
예제 #2
0
parser = argparse.ArgumentParser()
parser.add_argument(
    "-z",
    "--zip",
    action="store_true",
    help="Update from a build.zip file instead of downloading the update")
args = parser.parse_args()

autoupdate = AutoUpdate(BUILD, None)
if args.zip:
    archive = "updating/build.zip"
    if not os.path.exists(archive):
        print(f"The archived build {archive!r} couldn't be found.")
    else:
        autoupdate.path_archive = archive
        autoupdate.update(stdout=True)
else:
    print("Checking for updates...")
    build = autoupdate.check()
    if build is not None:
        print("A new update is available: {}.\n".format(build))
        autoupdate.download(stdout=True)
        autoupdate.update(stdout=True)
    else:
        print("No update is available, but download anyway.")
        autoupdate.download(stdout=True)
        autoupdate.update(stdout=True)

    os.system("pause")