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
23import logging.config
24from pathlib import Path
25from typing import List
26
27from codesign.macos_code_signer import MacOSCodeSigner
28import codesign.config_server
29
30if __name__ == "__main__":
31    entitlements_file = codesign.config_server.MACOS_ENTITLEMENTS_FILE
32    if not entitlements_file.exists():
33        raise SystemExit(
34            'Entitlements file {entitlements_file} does not exist.')
35    if not entitlements_file.is_file():
36        raise SystemExit(
37            'Entitlements file {entitlements_file} is not a file.')
38
39    logging.config.dictConfig(codesign.config_server.LOGGING)
40    code_signer = MacOSCodeSigner(codesign.config_server)
41    code_signer.run_signing_server()
42