1#!/usr/bin/env python3 2 3# ##### BEGIN GPL LICENSE BLOCK ##### 4# 5# This program is free software; you can redistribute it and/or 6# modify it under the terms of the GNU General Public License 7# as published by the Free Software Foundation; either version 2 8# of the License, or (at your option) any later version. 9# 10# This program is distributed in the hope that it will be useful, 11# but WITHOUT ANY WARRANTY; without even the implied warranty of 12# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 13# GNU General Public License for more details. 14# 15# You should have received a copy of the GNU General Public License 16# along with this program; if not, write to the Free Software Foundation, 17# Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 18# 19# ##### END GPL LICENSE BLOCK ##### 20 21# <pep8 compliant> 22 23# Implementation of codesign server for Windows. 24# 25# NOTE: If signtool.exe is not in the PATH use codesign_server_windows.bat 26 27import logging.config 28import shutil 29 30from pathlib import Path 31from typing import List 32 33import codesign.util as util 34 35from codesign.windows_code_signer import WindowsCodeSigner 36import codesign.config_server 37 38if __name__ == "__main__": 39 logging.config.dictConfig(codesign.config_server.LOGGING) 40 41 logger = logging.getLogger(__name__) 42 logger_server = logger.getChild('server') 43 44 # TODO(sergey): Consider moving such sanity checks into 45 # CodeSigner.check_environment_or_die(). 46 if not shutil.which('signtool.exe'): 47 if util.get_current_platform() == util.Platform.WINDOWS: 48 raise SystemExit("signtool.exe is not found in %PATH%") 49 logger_server.info( 50 'signtool.exe not found, ' 51 'but will not be used on this foreign platform') 52 53 code_signer = WindowsCodeSigner(codesign.config_server) 54 code_signer.run_signing_server() 55