Path: blob/main/tools/build_config/updateDailyVersion.py
169673 views
#!/usr/bin/env python1# -*- coding: utf-8 -*-2# Eclipse SUMO, Simulation of Urban MObility; see https://eclipse.dev/sumo3# Copyright (C) 2008-2025 German Aerospace Center (DLR) and others.4# This program and the accompanying materials are made available under the5# terms of the Eclipse Public License 2.0 which is available at6# https://www.eclipse.org/legal/epl-2.0/7# This Source Code may also be made available under the following Secondary8# Licenses when the conditions for such availability set forth in the Eclipse9# Public License 2.0 are satisfied: GNU General Public License, version 210# or later which is available at11# https://www.gnu.org/licenses/old-licenses/gpl-2.0-standalone.html12# SPDX-License-Identifier: EPL-2.0 OR GPL-2.0-or-later1314# @file updateDailyVersion.py15# @author Pablo Alvarez Lopez16# @date 2022-04-261718from __future__ import absolute_import19from __future__ import print_function20import os21import sys22import zipfile23import shutil2425# first check platform (currently only available in Windows)26if sys.platform != "win32":27print("This script only works in Windows")28sys.exit()2930# download sumo31print("Downloading daily SUMO...")32os.system('curl https://sumo.dlr.de/daily/sumo-win64extra-git.zip --output sumo.zip')3334# now check if sumo.zip exist35if os.path.exists("sumo.zip"):36print("Download successful. Unzipping ...")37else:38print("Error downloading SUMO")39sys.exit()4041# unzip SUMO42with zipfile.ZipFile("sumo.zip", 'r') as zip_ref:43zip_ref.extractall(".")4445# check if sumo-git exists46if os.path.exists("sumo-git"):47print("Unzip successful. Updating SUMO folder ...")48else:49print("Error unzipping SUMO")50sys.exit()5152# Copy all files53for src_dir, dirs, files in os.walk('./sumo-git'):54dst_dir = src_dir.replace('./sumo-git', '../../', 1)55if not os.path.exists(dst_dir):56os.makedirs(dst_dir)57for file_ in files:58src_file = os.path.join(src_dir, file_)59dst_file = os.path.join(dst_dir, file_)60if os.path.exists(dst_file):61# in case of the src and dst are the same file62if os.path.samefile(src_file, dst_file):63continue64os.remove(dst_file)65shutil.move(src_file, dst_dir)6667# write info68print("All files copied. Cleaning ...")6970# remove temporary files71os.remove("sumo.zip")72shutil.rmtree("sumo-git")7374# finished75print("Done.")767778