def get_linux_url(ver): url_table = linux64_TABLE result_str = '{}'.format(url_table.get(ver, "")) c.print('>>> linux url: {}'.format(result_str)) return result_str
def _build_form(self) -> None: print('Generating form sheets ...') check_call([ self._tool_path('formgen'), '-i', path_join('..', 'form.kxg'), '-p', str(self.sheet_count) ], cwd=self._tmp_form_dir())
def get_windows_url(os_bit, ver): if os_bit == 32: url_table = WIN32_TABLE else: url_table = WIN64_TABLE result_str = '{}'.format(url_table.get(ver, "")) c.print('>>> windows url: {}'.format(result_str)) return result_str
def _combine_sheets(self) -> None: print('Combining individual sheets into a resulting document ...') sheets = [ path_join(basename(self._tmp_overlay_dir()), f'Sheet_{sheet_num:02}.pdf') for sheet_num in range(1, self.sheet_count + 1) ] check_call( ['pdftk'] + sheets + ['cat', 'output', basename(self.document_path)], cwd=self.document_dir)
def convert(svg_file_path) -> None: pdf_file_path = svg_file_path[:-4] + '.pdf' if exists(path_join(self.document_dir, pdf_file_path)): source_mtime = stat(path_join(self.document_dir, svg_file_path)).st_mtime_ns target_mtime = stat(path_join(self.document_dir, pdf_file_path)).st_mtime_ns if source_mtime < target_mtime: print(f'File "{pdf_file_path}" is up to date.') return svg2pdf(url=path_join(self.document_dir, svg_file_path), write_to=path_join(self.document_dir, pdf_file_path))
def get_windows_arch(arch, os_bit, qtver): os_bit_str = {32: 'win32', 64: 'win64'} if arch == 'mingw': arch_ver = WIN_MINGW_ARCH else: # msvc arch_ver = WIN_MSVC_ARCH result_str = '{}_{}{}'.format(os_bit_str.get(os_bit, ""), arch, arch_ver.get(qtver, "")) c.print('>>> windows arch: {}'.format(result_str)) return result_str
def report_conflicts(self, before, after): ''' before list of all filenames before enter rename mode after list of all filenames upon commit rename Warn about conflicts and print original (before) and conflicting (after) names for each item which cause conflict. ''' sublime.error_message('There are duplicate filenames (see details in console)') self.view.window().run_command("show_panel", {"panel": "console"}) print(*(u'\n Original name: {0}\nConflicting name: {1}'.format(b, a) for (b, a) in zip(before, after) if b != a and a in before), sep='\n', end='\n\n') print('You can either resolve conflicts and apply changes or cancel renaming.\n')
def apply_renames(self, before, after): '''args are the same as in self.report_conflicts If before and after differ, try to do actual rename for each pair Take into account directory symlinks on Unix-like OSes (they cannot be just renamed) In case of error, show message and exit skipping remain pairs ''' # reverse order to allow renaming child and parent at the same time (tree view) diffs = list( reversed([(b, a) for (b, a) in zip(before, after) if b != a])) if not diffs: return sublime.status_message('Exit rename mode, no changes') path = self.path existing = set(before) while diffs: b, a = diffs.pop(0) if a in existing: # There is already a file with this name. Give it a temporary name (in # case of cycles like "x->z and z->x") and put it back on the list. tmp = tempfile.NamedTemporaryFile(delete=False, dir=path).name os.unlink(tmp) diffs.append((tmp, a)) a = tmp print(u'FileBrowser rename: {0} → {1}'.format(b, a)) orig = join(path, b) if orig[~0] == '/' and os.path.islink(orig[:~0]): # last slash shall be omitted; file has no last slash, # thus it False and symlink to file shall be os.rename'd dest = os.readlink(orig[:~0]) os.unlink(orig[:~0]) os.symlink(dest, join(path, a)[:~0]) else: try: os.rename(orig, join(path, a)) except OSError: msg = ( u'FileBrowser:\n\nError is occurred during renaming.\n' u'Please, fix it and apply changes or cancel renaming.\n\n' u'\t {0} → {1}\n\n' u'Don’t rename\n' u' • non-existed file (cancel renaming to refresh)\n' u' • file if you’re not owner' u' • disk letter on Windows\n'.format(b, a)) sublime.error_message(msg) return existing.remove(b) existing.add(a)
def get_windows_qt_dir_prefix(arch, os_bit, qtver): if arch == 'mingw': arch_ver = WIN_MINGW_ARCH else: # msvc arch_ver = WIN_MSVC_ARCH if arch == 'msvc' and os_bit == 32: m_str = '{}{}'.format(arch, arch_ver.get(qtver, "")) else: m_str = '{}{}_{}'.format(arch, arch_ver.get(qtver, ""), os_bit) result_str = '{}/{}'.format(qtver, m_str) c.print('>>> qt_dir_prefix: {}'.format(result_str)) return result_str
def _overlay_form(self) -> None: def overlay(sheet_num: int) -> None: data_page_path = path_join(basename(self._tmp_data_dir()), f'Sheet_{sheet_num:02}.pdf') form_page_path = path_join(basename(self._tmp_form_dir()), f'Sheet_{sheet_num:02}.pdf') overlay_page_path = path_join(basename(self._tmp_overlay_dir()), f'Sheet_{sheet_num:02}.pdf') check_call([ 'pdftk', form_page_path, 'stamp', data_page_path, 'output', overlay_page_path ], cwd=self.document_dir) print('Overlaying form sheets over data sheets ...') pool.map(overlay, range(1, self.sheet_count + 1), 1)
def apply_renames(self, before, after): '''args are the same as in self.report_conflicts If before and after differ, try to do actual rename for each pair Take into account directory symlinks on Unix-like OSes (they cannot be just renamed) In case of error, show message and exit skipping remain pairs ''' # reverse order to allow renaming child and parent at the same time (tree view) diffs = list(reversed([(b, a) for (b, a) in zip(before, after) if b != a])) if not diffs: return sublime.status_message('Exit rename mode, no changes') path = self.path existing = set(before) while diffs: b, a = diffs.pop(0) if a in existing: # There is already a file with this name. Give it a temporary name (in # case of cycles like "x->z and z->x") and put it back on the list. tmp = tempfile.NamedTemporaryFile(delete=False, dir=path).name os.unlink(tmp) diffs.append((tmp, a)) a = tmp print(u'FileBrowser rename: {0} → {1}'.format(b, a)) orig = join(path, b) if orig[~0] == '/' and os.path.islink(orig[:~0]): # last slash shall be omitted; file has no last slash, # thus it False and symlink to file shall be os.rename'd dest = os.readlink(orig[:~0]) os.unlink(orig[:~0]) os.symlink(dest, join(path, a)[:~0]) else: try: os.rename(orig, join(path, a)) except OSError: msg = (u'FileBrowser:\n\nError is occurred during renaming.\n' u'Please, fix it and apply changes or cancel renaming.\n\n' u'\t {0} → {1}\n\n' u'Don’t rename\n' u' • non-existed file (cancel renaming to refresh)\n' u' • file if you’re not owner' u' • disk letter on Windows\n'.format(b, a)) sublime.error_message(msg) return existing.remove(b) existing.add(a)
def run(self, edit, trash=False): self.index = self.get_all() files = self.get_marked() or self.get_selected(parent=False) if not files: return sublime.status_message('Nothing chosen') msg, trash = self.setup_msg(files, trash) if trash: need_confirm = self.view.settings().get('dired_confirm_send2trash', True) msg = msg.replace('Delete', 'Delete to trash', 1) if not need_confirm or (need_confirm and sublime.ok_cancel_dialog(msg)): self._to_trash(files) elif not trash and sublime.ok_cancel_dialog(msg): self._delete(files) else: print("Cancel delete or something wrong in DiredDeleteCommand")
def plugin_loaded(): if len(sublime.windows()) == 1 and len(sublime.windows()[0].views()) == 0: hijack_window() window = sublime.active_window() if not ST3: global recursive_plugin_loaded # recursion limit is 1000 generally, so it will try to refresh for 100*1000 ms (100 s) # if no active_window in 100 s, then no refresh # if view still loading, refresh fail because view cant be edited if not window or any(view.is_loading() for view in window.views()): recursive_plugin_loaded += 1 try: return sublime.set_timeout(plugin_loaded, 100) except RuntimeError: print( '\ndired.plugin_loaded run recursively %d time(s); and failed to refresh\n' % recursive_plugin_loaded) return for w in sublime.windows(): for v in w.views(): if v.settings() and v.settings().get("dired_path"): # reset sels because dired_index not exists yet, so we cant restore sels v.run_command("dired_refresh", {"reset_sels": True}) import sys dfsobserver = '%s0_dired_fs_observer' % ('FileBrowser.' if ST3 else '') if dfsobserver not in sys.modules or sys.modules[ dfsobserver].Observer is None: return sublime.error_message( u'FileBrowser:\n\n' u'watchdog module is not importable, hence we cannot know about ' u'changes on file system, and auto-refresh will not work.\n\n' u'Despite that, FileBrowser is fully usable without auto-refresh, ' u'you can just ignore this message and manually refresh view with r key.\n\n' u'But if you want working auto-refresh:\n' u' • if you install manually, then look at Readme how to install it,\n' u' • if you install via Package Control, report an issue.') sublime.load_settings('dired.sublime-settings').add_on_change( 'dired_autorefresh', lambda: emit_event( u'toggle_watch_all', sublime.load_settings('dired.sublime-settings').get( 'dired_autorefresh', None)))
def build_documents(self, project: str): for document in self.enumerate_project_documents(project): print( f'Building document "{document}" for project "{project}" ...') document_type = document_pattern.match(document).group(2) if document_type is None: # Спецификация SpecificationBuilder(self.root, project, document).build() elif document_type == 'ВП': # Ведомость покупных изделий RegisterBuilder(self.root, project, document).build() elif document_type == 'ПЭ3': # Перечень элементов ListOfElementsBuilder(self.root, project, document).build() elif document_type == 'РЭ': # Руководство по эксплуатации TextDocumentBuilder(self.root, project, document).build() else: assert False, f'Unknown document type: {document_type}' print( f'Document "{document}" of project "{project}" has been successfully built.' )
def download_mingw_tool(): qt_version_dotless = qt_version.replace('.', '') base_url = 'https://download.qt.io/online/qtsdkrepository/windows_x86/desktop/tools_mingw/' updates_file = 'Updates-{}-{}-{}.xml'.format(qt_version, os_name, 'qttool') c.download(base_url + '/Updates.xml', updates_file) updates = ET.parse(updates_file) updates_root = updates.getroot() all_modules = {} for i in updates_root.iter('PackageUpdate'): name = i.find('Name').text if 'debug' in name or not kit_arch in name: continue archives = i.find('DownloadableArchives') if archives.text is None: continue c.print(' archives: {}'.format(archives)) archives_parts = archives.text.split(',') version = i.find('Version').text c.print(' version: {}'.format(version)) for archive in archives_parts: archive = archive.strip() parts = archive.split('-') module_name = parts[0] all_modules[module_name] = { 'package': name, 'file': version + archive } if len(sys.argv) > 1: # handle subcommand if sys.argv[1] == 'list': c.print('Available modules:') for k in iter(sorted(all_modules.keys())): c.print(k, '---', all_modules[k]['file']) exit(0) file_name = all_modules[module_name]['file'] package = all_modules[module_name]['package'] c.print('download url: {}'.format(base_url + '/' + package + '/' + file_name)) c.download(base_url + '/' + package + '/' + file_name, file_name) c.extract(file_name, '.')
def _convert_svg_to_pdf(self, *tmp_dirs: str) -> None: def convert(svg_file_path) -> None: pdf_file_path = svg_file_path[:-4] + '.pdf' if exists(path_join(self.document_dir, pdf_file_path)): source_mtime = stat(path_join(self.document_dir, svg_file_path)).st_mtime_ns target_mtime = stat(path_join(self.document_dir, pdf_file_path)).st_mtime_ns if source_mtime < target_mtime: print(f'File "{pdf_file_path}" is up to date.') return svg2pdf(url=path_join(self.document_dir, svg_file_path), write_to=path_join(self.document_dir, pdf_file_path)) print('Converting SVG files to corresponding PDF ones ...') svg_files = [] for tmp_dir in tmp_dirs: svg_files.extend([ path_join(basename(tmp_dir), file_name) for file_name in listdir(tmp_dir) if file_name.endswith('.svg') ]) pool.map(convert, svg_files, 1)
def plugin_loaded(): if len(sublime.windows()) == 1 and len(sublime.windows()[0].views()) == 0: hijack_window() window = sublime.active_window() if not ST3: global recursive_plugin_loaded # recursion limit is 1000 generally, so it will try to refresh for 100*1000 ms (100 s) # if no active_window in 100 s, then no refresh # if view still loading, refresh fail because view cant be edited if not window or any(view.is_loading() for view in window.views()): recursive_plugin_loaded += 1 try: return sublime.set_timeout(plugin_loaded, 100) except RuntimeError: print('\ndired.plugin_loaded run recursively %d time(s); and failed to refresh\n' % recursive_plugin_loaded) return for v in window.views(): if v.settings() and v.settings().get("dired_path"): # reset sels because dired_index not exists yet, so we cant restore sels v.run_command("dired_refresh", {"reset_sels": True})
def plugin_loaded(): if len(sublime.windows()) == 1 and len(sublime.windows()[0].views()) == 0: hijack_window() window = sublime.active_window() if not ST3: global recursive_plugin_loaded # recursion limit is 1000 generally, so it will try to refresh for 100*1000 ms (100 s) # if no active_window in 100 s, then no refresh # if view still loading, refresh fail because view cant be edited if not window or any(view.is_loading() for view in window.views()): recursive_plugin_loaded += 1 try: return sublime.set_timeout(plugin_loaded, 100) except RuntimeError: print('\ndired.plugin_loaded run recursively %d time(s); and failed to refresh\n' % recursive_plugin_loaded) return for w in sublime.windows(): for v in w.views(): if v.settings() and v.settings().get("dired_path"): # reset sels because dired_index not exists yet, so we cant restore sels v.run_command("dired_refresh", {"reset_sels": True}) import sys dfsobserver = '%s0_dired_fs_observer' % ('FileBrowser.' if ST3 else '') if dfsobserver not in sys.modules or sys.modules[dfsobserver].Observer is None: return sublime.error_message( u'FileBrowser:\n\n' u'watchdog module is not importable, hence we cannot know about ' u'changes on file system, and auto-refresh will not work.\n\n' u'Despite that, FileBrowser is fully usable without auto-refresh, ' u'you can just ignore this message and manually refresh view with r key.\n\n' u'But if you want working auto-refresh:\n' u' • if you install manually, then look at Readme how to install it,\n' u' • if you install via Package Control, report an issue.') sublime.load_settings('dired.sublime-settings').add_on_change('dired_autorefresh', lambda: emit_event(u'toggle_watch_all', sublime.load_settings('dired.sublime-settings').get('dired_autorefresh', None)))
def enumerate_projects(self) -> List[str]: def is_project(candidate: str): return isdir(path_join( self.root, candidate)) and project_pattern.match(candidate) is not None print('Enumerating projects ...') projects = sorted(candidate for candidate in listdir(self.root) if is_project(candidate)) if not projects: print('No projects have been found') return [] print('The following projects have been found:') for project in projects: print(f'* {project}') return projects
def enumerate_project_documents(self, project: str) -> List[str]: def is_document(candidate: str): return isdir(path_join( self.root, project, candidate)) and document_pattern.match(candidate) is not None print(f'Enumerating project "{project}" documents ...') documents = sorted( candidate for candidate in listdir(path_join(self.root, project)) if is_document(candidate)) if not documents: print('No documents have been found') return [] print('The following documents have been found:') for document in documents: print(f'* {document}') return documents
def plugin_loaded(): if len(sublime.windows()) == 1 and len(sublime.windows()[0].views()) == 0: hijack_window() window = sublime.active_window() if not ST3: global recursive_plugin_loaded # recursion limit is 1000 generally, so it will try to refresh for 100*1000 ms (100 s) # if no active_window in 100 s, then no refresh # if view still loading, refresh fail because view cant be edited if not window or any(view.is_loading() for view in window.views()): recursive_plugin_loaded += 1 try: return sublime.set_timeout(plugin_loaded, 100) except RuntimeError: print( '\ndired.plugin_loaded run recursively %d time(s); and failed to refresh\n' % recursive_plugin_loaded) return for v in window.views(): if v.settings() and v.settings().get("dired_path"): # reset sels because dired_index not exists yet, so we cant restore sels v.run_command("dired_refresh", {"reset_sels": True})
def build_tools(script_path: str, force: bool): if not force: tools = ['2.106-form1', '2.106-form5', 'formgen', 'listofelgen'] if all( exists(path_join(script_path, 'tools', 'apps', tool, tool)) for tool in tools): # All tools are already built. return print('Building tools ...') tmp_path = path_join(script_path, 'tmp') if exists(tmp_path): rmtree(tmp_path) makedirs(tmp_path) check_call(['cmake', '..'], cwd=tmp_path) check_call([ 'cmake', '-DCMAKE_BUILD_TYPE=Release', '-DCMAKE_VERBOSE_MAKEFILE=1', '-G', 'Unix Makefiles', '..' ], cwd=tmp_path) check_call(['cmake', '--build', '.', '--config', 'Release'], cwd=tmp_path) rmtree(tmp_path) print('Tools have been built.')
def downloadQtPackge(): qt_version_dotless = qt_version.replace('.', '') base_url = 'https://download.qt.io/online/qtsdkrepository/{}/{}/qt5_{}' \ .format(os_url, target_platform ,qt_version_dotless) updates_file = 'Updates-{}-{}.xml'.format(qt_version, os_name) c.download(base_url + '/Updates.xml', updates_file) updates = ET.parse(updates_file) updates_root = updates.getroot() all_modules = {} for i in updates_root.iter('PackageUpdate'): name = i.find('Name').text if 'debug' in name or not kit_arch in name: continue archives = i.find('DownloadableArchives') if archives.text is None: continue archives_parts = archives.text.split(',') version = i.find('Version').text for archive in archives_parts: archive = archive.strip() parts = archive.split('-') module_name = parts[0] all_modules[module_name] = { 'package': name, 'file': version + archive } if len(sys.argv) > 1: # handle subcommand if sys.argv[1] == 'list': c.print('Available modules:') for k in iter(sorted(all_modules.keys())): c.print(k, '---', all_modules[k]['file']) exit(0) for module in qt_modules_list: if module not in all_modules: c.print('>> Required module {} not available'.format(module)) continue file_name = all_modules[module]['file'] package = all_modules[module]['package'] c.download(base_url + '/' + package + '/' + file_name, file_name) c.extract(file_name, '.')
def build(self) -> None: if self.__is_document_up_to_date(): print( f'Document "{self.document}" of project "{self.project}" is up to date. Nothing to do.' ) return for tmp_dir in (self._tmp_data_dir(), self._tmp_form_dir(), self._tmp_overlay_dir()): if exists(tmp_dir): rmtree(tmp_dir) makedirs(tmp_dir) print('Generating sheets ...') self._actual_build() self._calculate_sheet_count() if self.sheet_count == 0: raise DocumentBuilderException('No data has been generated') print(f'{self.sheet_count} sheet(s) has/have been generated.') self._build_form() self._convert_svg_to_pdf(*self._managed_tmp_dirs()) self._overlay_form() self._combine_sheets()
import common as c from config import bitness, msvc_version, build_dir, dependencies_dir, build_type import os import platform c.print('>> Installing tesseract') install_dir = dependencies_dir url = 'https://github.com/tesseract-ocr/tesseract/archive/4.1.1.tar.gz' required_version = '4.1.1' build_type_flag = 'Debug' if build_type == 'debug' else 'Release' # compatibility flags compat_flags = '' if os.environ.get('NO_AVX2', '0') == '1': compat_flags += ' -D USE_AVX2=OFF ' if os.environ.get('NO_AVX512', '0') == '1': compat_flags += ' -D USE_AVX512BW=OFF -D USE_AVX512CD=OFF \ -D USE_AVX512DQ=OFF -D USE_AVX512ER=OFF -D USE_AVX512F=OFF -D USE_AVX512IFMA=OFF \ -D USE_AVX512PF=OFF -D USE_AVX512VBMI=OFF -D USE_AVX512VL=OFF ' if os.environ.get('NO_AVX', '0') == '1': compat_flags += ' -D USE_AVX=OFF ' if os.environ.get('NO_FMA', '0') == '1': compat_flags += ' -D USE_FMA=OFF ' if os.environ.get('NO_BMI2', '0') == '1': compat_flags += ' -D USE_BMI2=OFF ' if os.environ.get('NO_SSE4', '0') == '1': compat_flags += ' -D USE_SSE4_1=OFF -D USE_SSE4_2=OFF ' if os.environ.get('NO_OPT', '0') == '1': compat_flags += ' -D CMAKE_CXX_FLAGS_RELEASE="/MD /Od /Od0 /DNDEBUG" '
import common as c from config import qtc_version, os_name import os import shutil c.print('>> Downloading Qt Creator {} for {}'.format(qtc_version, os_name)) WIN32_TABLE = { '4.5': 'windows_vs2015_32', '4.6': 'windows_vs2015_32', '4.7': 'windows_vs2015_32', '4.8': 'windows_vs2015_32', '4.9': 'windows_msvc2017_x86', '4.10': 'windows_msvc2017_x86', '4.11': 'windows_msvc2017_x86', '4.12': 'windows_msvc2017_x86', '4.13': 'windows_x86', '4.14': 'windows_x86' } WIN64_TABLE = { '4.5': 'windows_vs2015_32', '4.6': 'windows_vs2015_64', '4.7': 'windows_vs2015_64', '4.8': 'windows_vs2015_64', '4.9': 'windows_msvc2017_x64', '4.10': 'windows_msvc2017_x64', '4.11': 'windows_msvc2017_x64', '4.12': 'windows_msvc2017_x64', '4.13': 'windows_x64', '4.14': 'windows_x64'
import common as c from config import * import os import sys import shutil from glob import glob tag = os.environ.get('TAG', '') artifact_name = '{}-{}{}-{}.zip'.format(app_name, app_version, tag, os_name) if len(sys.argv) > 1 and sys.argv[1] == 'artifact_name': # subcommand c.print(artifact_name) exit(0) artifact_path = os.path.abspath(artifact_name) c.print('>> Making win deploy') if os_name.startswith('win'): env_cmd = c.get_msvc_env_cmd(bitness=bitness, msvc_version=msvc_version) c.apply_cmd_env(env_cmd) pwd = os.getcwd() os.chdir(build_dir) install_dir = os.path.abspath(app_name) c.recreate_dir(install_dir) c.run('nmake INSTALL_ROOT="{0}" DESTDIR="{0}" install'.format(install_dir)) c.run('{}/bin/windeployqt.exe "{}"'.format(qt_dir, install_dir)) vcredist_for_ssl_url = '' vcredist_for_ssl_file = ''
import common as c from config import * import os import platform import glob c.print('>> Testing {} on {}'.format(app_name, os_name)) c.add_to_path(os.path.abspath(qt_dir + '/bin')) if platform.system() == "Windows": env_cmd = c.get_msvc_env_cmd(bitness=bitness, msvc_version=msvc_version) c.apply_cmd_env(env_cmd) c.recreate_dir(build_dir) os.chdir(build_dir) c.set_make_threaded() c.run('qmake {} "{}"'.format(os.environ.get('QMAKE_FLAGS', ''), test_pro_file)) make_cmd = c.get_make_cmd() c.run(make_cmd) for file in glob.glob('./**/tests*', recursive=True): print(file) c.run(file, silent=False)
import common as c from config import * import os import sys import subprocess as sub import shutil from glob import glob if len(sys.argv) > 1 and sys.argv[1] == 'glibc_version': # subcommand sub.run('ldd --version | head -n 1 | grep -Po "\\d\\.\\d\\d"', shell=True) exit(0) tag = os.environ.get('TAG', '') artifact_name = '{}-{}{}.AppImage'.format(app_name, app_version, tag) if len(sys.argv) > 1 and sys.argv[1] == 'artifact_name': # subcommand c.print(artifact_name) exit(0) artifact_path = os.path.abspath(artifact_name) c.print('>> Making appimage') base_url = 'https://github.com/probonopd/linuxdeployqt/releases/download' continuous_url = base_url + '/continuous/linuxdeployqt-continuous-x86_64.AppImage' tagged_url = base_url + '/6/linuxdeployqt-6-x86_64.AppImage' linuxdeployqt_url = tagged_url linuxdeployqt_original = os.path.basename(linuxdeployqt_url) c.download(linuxdeployqt_url, linuxdeployqt_original) c.run('chmod a+x {}'.format(linuxdeployqt_original)) linuxdeployqt_bin = os.path.abspath('linuxdeployqt')
import common as c from config import app_version import sys import os import io import urllib import platform from paramiko import SSHClient, WarningPolicy, RSAKey, SSHException files = sys.argv[1:] c.print('>> Uploading artifacts to sourceforge {}'.format(files)) for f in files: if not os.path.exists(f): c.print('>> File "{}" not exists. Exiting'.format(f)) exit(0) pkey_name = 'SF_PKEY' if not pkey_name in os.environ: c.print('>> No sf pkey set. Exiting') exit(0) api_name = 'SF_API' if not api_name in os.environ: c.print('>> No sf api set. Exiting') exit(0) pkey_data = io.StringIO(os.environ[pkey_name]) pkey = None try: pkey = RSAKey.from_private_key(pkey_data)
import common as c from config import qtc_version, os_name, plugin_name, pro_file, ts_files_dir import os import shutil import sys import multiprocessing archive_extension = 'zip' if os_name.startswith('win') else 'tar.gz' archive_name = '{}-{}-{}.{}'.format(plugin_name, qtc_version, os_name, archive_extension) if len(sys.argv) > 1: # handle subcommand if sys.argv[1] == 'artifact_name': c.print(archive_name) exit(0) c.print('>> Building {} on {}'.format(plugin_name, os_name)) env_script = 'true' path_separator = ':' make_cmd = 'make -j{}'.format(multiprocessing.cpu_count()) qm_files_dir = 'share/qtcreator/translations' if os_name == 'linux': plugin_bin = 'lib/qtcreator/plugins/lib{}.so'.format(plugin_name) elif os_name == 'macos': plugin_bin = 'Qt Creator.app/Contents/PlugIns/lib{}.dylib'.format( plugin_name) qm_files_dir = 'Qt Creator.app/Contents/Resources/translations' else: plugin_bin = 'lib/qtcreator/plugins/{}5.dll'.format(plugin_name)
import common as c from config import * import os import sys artifact_name = '{}-{}.dmg'.format(app_name, app_version) if len(sys.argv) > 1 and sys.argv[1] == 'artifact_name': # subcommand c.print(artifact_name) exit(0) artifact_path = os.path.abspath(artifact_name) c.print('>> Making mac deploy') os.chdir(build_dir) c.run('cmake --build . --target install') build_target = build_dir + '/' + target_name + '.app' built_dmg = build_dir + '/' + target_name + '.dmg' c.run('{}/bin/macdeployqt "{}" -dmg'.format(qt_dir, build_target)) os.rename(built_dmg, artifact_path)
import common as c from config import bitness, msvc_version, build_dir, dependencies_dir, build_type import os import platform c.print('>> Installing hunspell') install_dir = dependencies_dir url = 'https://github.com/hunspell/hunspell/files/2573619/hunspell-1.7.0.tar.gz' required_version = '1.7.0' build_type_flag = 'Debug' if build_type == 'debug' else 'Release' cache_file = install_dir + '/hunspell.cache' cache_file_data = required_version + build_type_flag def check_existing(): if not os.path.exists(cache_file): return False with open(cache_file, 'r') as f: cached = f.read() if cached != cache_file_data: return False if platform.system() == "Windows": dll = install_dir + '/bin/hunspell.dll' lib = install_dir + '/lib/hunspell.lib' if not os.path.exists(dll) or not os.path.exists(lib): return False