mirror of
https://github.com/ModOrganizer2/modorganizer-umbrella.git
synced 2026-07-27 13:58:32 -07:00
68 lines
2.9 KiB
Python
68 lines
2.9 KiB
Python
# Copyright (C) 2015 Sebastian Herbord. All rights reserved.
|
|
# Copyright (C) 2016 - 2019 Mod Organizer contributors.
|
|
#
|
|
# This file is part of Mod Organizer.
|
|
#
|
|
# Mod Organizer is free software: you can redistribute it and/or modify
|
|
# it under the terms of the GNU General Public License as published by
|
|
# the Free Software Foundation, either version 3 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# Mod Organizer is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License
|
|
# along with Mod Organizer. If not, see <http://www.gnu.org/licenses/>.
|
|
|
|
import os.path
|
|
import shutil
|
|
import logging
|
|
from config import config
|
|
from unibuild import Project
|
|
from unibuild.modules import github, build
|
|
|
|
build_path = os.path.join(config['paths']['build'])
|
|
|
|
# emulates shutil.copytree() with dirs_exist_ok=True
|
|
def copytree_fixed(src, dst, symlinks=False, ignore=None):
|
|
if not os.path.exists(dst):
|
|
os.makedirs(dst, exist_ok=True)
|
|
|
|
for item in os.listdir(src):
|
|
s = os.path.join(src, item)
|
|
d = os.path.join(dst, item)
|
|
if os.path.isdir(s):
|
|
copytree_fixed(s, d, symlinks, ignore)
|
|
else:
|
|
shutil.copy2(s, d)
|
|
|
|
def copy_stylesheets(context, dir):
|
|
src = os.path.join(build_path, dir)
|
|
dst = os.path.join(config["paths"]["install"], "bin", "stylesheets")
|
|
logging.info("copying stylesheets from {} to {}".format(src, dst))
|
|
# once python 3.8 becomes a requirement, this can be replaced by:
|
|
# shutil.copytree(src, dst, dirs_exist_ok=True)
|
|
copytree_fixed(src, dst)
|
|
return True
|
|
|
|
def create_stylesheet_project(author, name, filename=None, version_prefix="", extension="7z"):
|
|
version = version_prefix + config[name + "_version"]
|
|
if filename is None:
|
|
filename = config[name + "_version"]
|
|
dir = name + "-" + version
|
|
|
|
Project(name) \
|
|
.depend(build.Execute(lambda context: copy_stylesheets(context, dir))
|
|
.depend(github.Release(author, name, version, filename, extension)))
|
|
|
|
create_stylesheet_project("6788-00", "paper-light-and-dark", version_prefix="v")
|
|
create_stylesheet_project("6788-00", "paper-automata", "Paper-Automata", version_prefix="v")
|
|
create_stylesheet_project("6788-00", "paper-mono", "Paper-Mono", version_prefix="v")
|
|
create_stylesheet_project("6788-00", "1809-dark-mode", version_prefix="v")
|
|
create_stylesheet_project("Trosski", "ModOrganizer_Style_Morrowind", "Morrowind-MO2-Stylesheet")
|
|
create_stylesheet_project("Trosski", "Mod-Organizer-2-Skyrim-Stylesheet", "Skyrim-MO2-Stylesheet", version_prefix="v")
|
|
create_stylesheet_project("Trosski", "ModOrganizer_Style_Fallout3", "Fallout3-MO2-Stylesheet", version_prefix="v")
|
|
create_stylesheet_project("Trosski", "Mod-Organizer2-Fallout-4-Stylesheet", "Fallout4-MO2-Stylesheet", version_prefix="v")
|