PK!GƂnncommons_1c/__init__.py# -*- coding: utf-8 -*- # noinspection PyUnresolvedReferences from commons_1c.__about__ import __version__ PK!q1";;commons_1c/platform_.py# -*- coding: utf-8 -*- from pathlib import Path from appdirs import site_data_dir from cjk_commons.settings import get_path_attribute from commons_1c.version import get_version_as_number def get_last_1c_exe_file_fullpath(**kwargs) -> Path: result = None config_file_fullpath = get_path_attribute( kwargs, 'config_file_path', default_path=Path(site_data_dir('1CEStart', '1C'), '1CEStart.cfg'), is_dir=False, check_if_exists=False) if config_file_fullpath.is_file(): installed_location_fullpaths = [] with config_file_fullpath.open(encoding='utf-16') as config_file: for line in config_file.readlines(): key_and_value = line.split('=') if key_and_value[0] == 'InstalledLocation': value = '='.join(key_and_value[1:]) installed_location_fullpaths.append(Path(value.rstrip('\r\n'))) platform_versions = [] for installed_location_fullpath in installed_location_fullpaths: if installed_location_fullpath.is_dir(): for version_dir_fullpath in installed_location_fullpath.rglob('*'): # todo version_as_number = get_version_as_number(version_dir_fullpath.name) if version_as_number: exe_file_fullpath = Path(version_dir_fullpath, 'bin', '1cv8.exe') if exe_file_fullpath.is_file(): platform_versions.append((version_as_number, exe_file_fullpath)) platform_versions_reversed = sorted(platform_versions, key=lambda x: x[0], reverse=True) if platform_versions_reversed: result = platform_versions_reversed[0][1] else: raise FileExistsError('1CEStart.cfg file does not exist') return result PK!3Mcommons_1c/version.py# -*- coding: utf-8 -*- from typing import List import re pattern_version = re.compile(r'\D*(?P(?:(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|)(?:\.(\d+)|))\D*') def get_version_as_number(version: str) -> int: result = 0 m = 10000 match = pattern_version.match(version) if match is not None: a = match.group(2) a = '0' if a is None else a b = match.group(3) b = '0' if b is None else b c = match.group(4) c = '0' if c is None else c d = match.group(5) d = '0' if d is None else d result = int(a) * m ** 3 + int(b) * m ** 2 + int(c) * m + int(d) return result def get_version_as_parts(version: str) -> List[str]: result = [] match = pattern_version.match(version) if match is not None: a = match.group(2) if a is not None: result.append(a) b = match.group(3) if b is not None: result.append(b) c = match.group(4) if c is not None: result.append(c) d = match.group(5) if d is not None: result.append(d) return result PK!HڽTU commons_1c-3.1.1.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!HǓs#commons_1c-3.1.1.dist-info/METADATAKO0^ԸTBMD5{.a ssǾ(e>5󪸖SVkkBYZUZ`WgL2J'[17YG;~a L j~W݋MR*)n{o,AKhm>z8' ?*f TNleL &d?):L (d|lN&nVs6ugorMͽB6Qp]&p޶^j|Hafѿ[]Z5dʹQµϹǧ~s8o^ЉKYSoHWtq]SG>.I =?1К0A9Ih,?bv,i^z+j7|7(i 5BjX0ՑhdUZV \xK+W,.Ig􎶐jZPK!GƂnncommons_1c/__init__.pyPK!q1";;commons_1c/platform_.pyPK!3Mcommons_1c/version.pyPK!HڽTU  commons_1c-3.1.1.dist-info/WHEELPK!HǓs#q commons_1c-3.1.1.dist-info/METADATAPK!HC ,!9commons_1c-3.1.1.dist-info/RECORDPK