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.2.dist-info/WHEEL A н#Z;/"d&F[xzw@Zpy3Fv]\fi4WZ^EgM_-]#0(q7PK!HE|#commons_1c-3.1.2.dist-info/METADATAN1,Ra5 HDٝl&Y(ol-,Ex}QU*H>9W$/ք,/l!r1b뤵'o\^y n̩lctA5mzTv8O;X D--^y9 6Kqk=El0"w0DɕsM/s1LF3SY-WNgFAՒgFRoPK!Huχ',!commons_1c-3.1.2.dist-info/RECORD}Kr0}h(. ~ATM&)Hӷ a쎱t{ uJ2|PBnv6aLV1 J?V 0 ܬA#nܓbCKl u+ޜH9:ll 6lb1 ߹T 6ml_tQˢOg%},Q#v?FEbM% A)께+v/ ;qvhn*VHX<9J傪c-jj/9(kZIjw7=ߒ\mgI!a&w-GC>~PK!GƂnncommons_1c/__init__.pyPK!q1";;commons_1c/platform_.pyPK!3Mcommons_1c/version.pyPK!HڽTU  commons_1c-3.1.2.dist-info/WHEELPK!HE|#q commons_1c-3.1.2.dist-info/METADATAPK!Huχ',!.commons_1c-3.1.2.dist-info/RECORDPK