From a2ce16bcf114b139e17a29678cf41d51dbd85e6e Mon Sep 17 00:00:00 2001 From: Daniil Irkhin Date: Tue, 3 Sep 2024 19:19:33 +0300 Subject: [PATCH] initial commit --- LICENSE | 8 +- README.md | 136 ++++++++++++++++++++++++++++++- build.bat | 7 ++ env.iss | 44 ++++++++++ icon.ico | Bin 0 -> 16958 bytes main.py | 207 +++++++++++++++++++++++++++++++++++++++++++++++ poetry.lock | 137 +++++++++++++++++++++++++++++++ pyproject.toml | 18 +++++ setup-readme.txt | 9 +++ setup.iss | 36 +++++++++ 10 files changed, 597 insertions(+), 5 deletions(-) create mode 100644 build.bat create mode 100644 env.iss create mode 100644 icon.ico create mode 100644 main.py create mode 100644 poetry.lock create mode 100644 pyproject.toml create mode 100644 setup-readme.txt create mode 100644 setup.iss diff --git a/LICENSE b/LICENSE index dbc6178..bfc8171 100644 --- a/LICENSE +++ b/LICENSE @@ -1,9 +1,9 @@ -MIT License +MIT Лицензия Copyright (c) 2024 Dj_Haski -Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions: +Данная лицензия разрешает лицам, получившим копию данного программного обеспечения и сопутствующей документации (далее — Программное обеспечение), безвозмездно использовать Программное обеспечение без ограничений, включая неограниченное право на использование, копирование, изменение, слияние, публикацию, распространение, сублицензирование и/или продажу копий Программного обеспечения, а также лицам, которым предоставляется данное Программное обеспечение, при соблюдении следующих условий: -The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software. +Указанное выше уведомление об авторском праве и данные условия должны быть включены во все копии или значимые части данного Программного обеспечения. -THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +ДАННОЕ ПРОГРАММНОЕ ОБЕСПЕЧЕНИЕ ПРЕДОСТАВЛЯЕТСЯ «КАК ЕСТЬ», БЕЗ КАКИХ-ЛИБО ГАРАНТИЙ, ЯВНО ВЫРАЖЕННЫХ ИЛИ ПОДРАЗУМЕВАЕМЫХ, ВКЛЮЧАЯ ГАРАНТИИ ТОВАРНОЙ ПРИГОДНОСТИ, СООТВЕТСТВИЯ ПО ЕГО КОНКРЕТНОМУ НАЗНАЧЕНИЮ И ОТСУТСТВИЯ НАРУШЕНИЙ, НО НЕ ОГРАНИЧИВАЯСЬ ИМИ. НИ В КАКОМ СЛУЧАЕ АВТОРЫ ИЛИ ПРАВООБЛАДАТЕЛИ НЕ НЕСУТ ОТВЕТСТВЕННОСТИ ПО КАКИМ-ЛИБО ИСКАМ, ЗА УЩЕРБ ИЛИ ПО ИНЫМ ТРЕБОВАНИЯМ, В ТОМ ЧИСЛЕ, ПРИ ДЕЙСТВИИ КОНТРАКТА, ДЕЛИКТЕ ИЛИ ИНОЙ СИТУАЦИИ, ВОЗНИКШИМ ИЗ-ЗА ИСПОЛЬЗОВАНИЯ ПРОГРАММНОГО ОБЕСПЕЧЕНИЯ ИЛИ ИНЫХ ДЕЙСТВИЙ С ПРОГРАММНЫМ ОБЕСПЕЧЕНИЕМ. diff --git a/README.md b/README.md index a185e5c..2f54be0 100644 --- a/README.md +++ b/README.md @@ -1,3 +1,137 @@ # fortrun -Утилита для альтернативного способа запуска устаревших Fortran проектов. Разработано специально для студентов МАИ. \ No newline at end of file +"Fortran" + "run" = fortrun + +Утилита для альтернативного способа запуска устаревших Fortran проектов в любимых редакторах. Разработано специально для студентов МАИ, чтобы избавить их от необходимости разрабатывать в устаревших программах без прикольных фич. + +**Attention!** Данная программа не решит за вас нужные работы, но избавит от лишней головной боли в войне с устаревшим Fortran. + +## Требования + +- **Windows 10 и выше** (программа может работать и с ранними версиями, но не проверялась) +- **Microsoft PowerStation 4.0** - Без него программа не заработает, т.к. в нем содержится нужный компилятор и линкер. В ином случае, программа предупредит вас об отсутствии нужных файлов и откажется сотрудничать. +- **[Visual Studio Code](https://code.visualstudio.com/)** (или любой другой редактор с терминалом, либо ручками) +- Хотя бы небольшое количество прямых лапок + +## Установка + +### Способ для ленивых +Вы можете пропустить нюансы, установив ПО используя [последнюю версию установщика](https://git.dj-haski.ru/Dj_Haski/fortrun/...). + +После установки можете переходить сразу к **Использованию**. + +### Способ для умных и прекрасных + +Вам будет необходим Poetry ([установка](https://python-poetry.org/docs/)) и Python 3.10+ ([установка](https://www.python.org/downloads/)). + +Склонируйте репозиторий и перейдите в его папку: + +```bash +$ git clone https://git.dj-haski.ru/Dj_Haski/fortrun +Cloning into 'fortrun'... +... +$ cd fortrun/ +``` + +Установите пакеты Poetry: + +```bash +$ poetry install +``` + +Запустите файл main.py с нужными параметрами: + +```bash +$ poetry run main.py --help +# либо сразу +$ poetry run main.py build FA.F90 VAP4.F90 bm_nlp-msdev.lib --run --friendly +``` + +Бинго, вы прекрасны! Дальше по накатанной. + +## Использование + +### Подготовка для Visual Studio Code + +Эта часть подразумевает, что вы установили ПО используя установщик. + +1) Откройте Visual Studio Code +2) Откройте папку, где будут тусоваться ваши исходные файлы: *Файл -> Открыть папку...* +3) Создайте терминал, если его нет внизу: *Терминал -> Новый терминал* +4) Используйте перечисленные команды ниже, чтобы достичь нужного результата. + +### Подготовка для умных и прекрасных + +Если вы пошли сложным путем, то вам необходимо самостоятельно добавить `main.py` в PATH и настроить Windows для работы с `.py` файлами. + +Либо же вызывать программу таким образом: + +```bash +$ python c:/путь/до/файла/main.py ... +``` + +### Примеры команд (для лабораторных) + +Сразу оговорюсь, если у вас ничего не происходит после запуска, то вам необходимо нажать `ENTER`, так как скорее всего у вас стоит `PAUSE` в конце программы. + +#### Запуск в дружелюбном режиме + +Данная команда соберет два нужных файла + библиотеку, запустит её в "дружелюбном" режиме и превратит сложные отображения цифр (.19375D+01 или -.22352D-07) в простые (0.3959 или -0.00008). + +Учтите, что в собранной программе не будет дружелюбного отображения, так как этим занимается `fortrun`. + +```bash +$ fortrun build FA.F90 VAP4.F90 bm_nlp-msdev.lib --run --friendly +``` + +#### Запуск в обычном режиме + +Данная команда соберет два нужных файла + библиотеку и запустит её в обычном режиме. + +```bash +$ fortrun build FA.F90 VAP4.F90 bm_nlp-msdev.lib --run +``` + +#### Сборка файла + +Данная команда соберет два нужных файла + библиотеку в файл под названием "lab2.exe". + +```bash +$ fortrun build FA.F90 VAP4.F90 bm_nlp-msdev.lib --friendly --output lab2.exe +``` + +### Документация по параметрам + +Помощь доступна через команду `fortrun --help`. + +- **fortrun version** - Просто выводит версию. И всё. +- **fortrun build** - Основная команда для компиляции и линковки файлов + библиотек. Флаги представлены ниже. + - **--output [ФАЙЛ]** - Собрать всё в указанный файл. + - **--run** - Запустить программу сразу после сборки. + - **--friendly** - Работает только с `--run`. Заменять представления чисел Fortran на человекочитаемые. + - **--clean** - Очистить папку сборки после компиляции. + - **--pause** - Поставить программу на паузу после выполнения. Полезно в некоторых сценариях. + +## FAQ (Часто задаваемые вопросы) + +| **У меня пишутся какие-то "warning: ", это нормально?** + +Да. Скорее всего, на это не стоит обращать внимания, т.к. в лабораторных встречались такие сценарии, которые никак не влияют на работу. + +| **Что значит ошибка "Looks like compilation or linking failed. Perhaps you forgot to add some libraries or some source files? Check your source code and try again."** + +Вероятно, вы просто напросто забыли подключить нужную библиотеку (например: `bm_nlp-msdev.lib`), поэтому линкер не смог закончить свою работу. Гляньте на примеры. + +| **fortrun вылетает со странной ошибкой** + +Свяжитесь со мной по почте, указанной ниже. Не забудьте приложить скриншот проблемы. + +| **Тут есть вирусы?** или **Антивирус [название] жалуется на твой файл!** + +Исходный код доступен прямо у вас перед глазами, если вы не доверяете готовым сборкам. К сожалению, в виду неизвестного происхождения файла (мы же с вами тут не Яндексы, чтоб все нас знали), файл может ложно помечаться как вредоностный. Исправление этой проблемы слишком дорогое (подпись исполняемых файлов для повышения репутации) для такого маленького проекта. + +## Контакты + +В случае обнаружения бага или при наличии интересного предложения, свяжитесь со мной по почте: me@dj-haski.ru + +Вопросы не касающиеся работы `fortrun` (этой проги), в 90% случаев остануться без ответа, ищите решение ошибок Fortran и лабораторных самостоятельно :) \ No newline at end of file diff --git a/build.bat b/build.bat new file mode 100644 index 0000000..6a267c7 --- /dev/null +++ b/build.bat @@ -0,0 +1,7 @@ +@echo off + +echo Building... + +pyinstaller --icon icon.ico --collect-submodules shellingham --onefile --console --clean --name=fortrun --add-data="icon.ico;." main.py + +echo Done \ No newline at end of file diff --git a/env.iss b/env.iss new file mode 100644 index 0000000..f39e252 --- /dev/null +++ b/env.iss @@ -0,0 +1,44 @@ +[Code] +const EnvironmentKey = 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment'; + +procedure EnvAddPath(Path: string); +var + Paths: string; +begin + { Retrieve current path (use empty string if entry not exists) } + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) + then Paths := ''; + + { Skip if string already found in path } + if Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';') > 0 then exit; + + { App string to the end of the path variable } + Paths := Paths + ';'+ Path +';' + + { Overwrite (or create if missing) path environment variable } + if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) + then Log(Format('The [%s] added to PATH: [%s]', [Path, Paths])) + else Log(Format('Error while adding the [%s] to PATH: [%s]', [Path, Paths])); +end; + +procedure EnvRemovePath(Path: string); +var + Paths: string; + P: Integer; +begin + { Skip if registry entry not exists } + if not RegQueryStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) then + exit; + + { Skip if string not found in path } + P := Pos(';' + Uppercase(Path) + ';', ';' + Uppercase(Paths) + ';'); + if P = 0 then exit; + + { Update path variable } + Delete(Paths, P - 1, Length(Path) + 1); + + { Overwrite path environment variable } + if RegWriteStringValue(HKEY_LOCAL_MACHINE, EnvironmentKey, 'Path', Paths) + then Log(Format('The [%s] removed from PATH: [%s]', [Path, Paths])) + else Log(Format('Error while removing the [%s] from PATH: [%s]', [Path, Paths])); +end; \ No newline at end of file diff --git a/icon.ico b/icon.ico new file mode 100644 index 0000000000000000000000000000000000000000..ab0df719c0ec947a71eb88c901fb27fc958778ee GIT binary patch literal 16958 zcmeI4!A{#i5QaBRTS}o65y7caazY$?<%GqVN}S+mzd@b=#iw4~YcJ&y@(Mgbd4q;0 zC_VOoF!OsI30d*luH4xnJBucZch}zeW@a~&7-P(Uexk_G>%<(L8gpQbIU=DZlaipl zD3LLvEi1Oc`I=DgoaB}yf1$D{8KzY4lC&ua4Z?XZmAOvudty2#ag`Z$)}6mD?OBZh z(7rB=O&qg|4G`U9k#6Az0AMA*Or9DEcZv$oz z&DY8s?mAcBtM4@idX9mU!#BBa`TXfMyI*(T5At7MNBQIT0}%pUCZktuc9@-Q72H4K zojf_-^eWlqcA-mlvCYPRP2BLkl-v=zz!zNlD8Kq&<6qZ5*M8G9kM4hR_W$YWrZX2o z?lh)c#U)MtuJ%jue?<8(baCZl$?>~l493;Tcr@(vUM__newlr-xnZ3RU?b!YEr|US0{9Np? zl{9`%c4_?F?2`C>uuI~{cd@^-{UQg1UR)w+{ZBgP?tR!u5`P~&U9X}1az6ie^<5w1 z)&J^$&ify@*Myiu9n<$YKIJ<3U_W2bJ-I&CQk!ewJx<#FPvl;0bnkNv@}21Lt#|2@ zNw3A1x2mnx)*1sE0~!NfV<6lzkDV%@vMsv z+gG0jO#`w)My#vKH){0Z3(h&yRp8Is5Eob*oH}vLwIHVW8K>)4>^~Q~@hpDXxwxWL}phdI=(o(y!9^BaD;hn8FmVW+gk58Te DCX7iA literal 0 HcmV?d00001 diff --git a/main.py b/main.py new file mode 100644 index 0000000..2695d56 --- /dev/null +++ b/main.py @@ -0,0 +1,207 @@ +import datetime +from pathlib import Path +import sys +from typing import Annotated, Optional +import typer +from subprocess import Popen, PIPE +import subprocess +import os +import re +import shutil +sys.stdin.reconfigure(encoding='utf-8') +sys.stdout.reconfigure(encoding='utf-8') + +__VERSION__ = "1.2" +__AUTHORS__ = ("Dj_Haski",) +__LICENSE__ = "MIT" +app = typer.Typer() + + +def print_header(): + print(f'Fortrun by {", ".join(__AUTHORS__)} v{__VERSION__} ({__LICENSE__})') + print( + f'Copyright (c) 2022-{datetime.datetime.now().year}, {", ".join(__AUTHORS__)}\n' + ) + + +def errexit(message: str): + typer.echo(typer.style(f"error: ", fg=typer.colors.RED) + message) + typer.echo( + "Compilation " + typer.style(f"failed", fg=typer.colors.RED) + ", exiting..." + ) + sys.exit(-1) + + +def info(message: str): + typer.echo(typer.style(f"info: ", fg=typer.colors.CYAN) + message) + + +def hint(message: str): + typer.echo(typer.style(f"hint: ", fg=typer.colors.YELLOW) + message) + +def safe_check_output(command, encoding='utf-8'): + try: + return subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT, encoding=encoding) + except subprocess.CalledProcessError as e: + return e.output + +def try_or_exit(command: str): + try: + subprocess.check_output(command, shell=True, stderr=subprocess.STDOUT) + return True + except subprocess.CalledProcessError as e: + hint( + "Looks like compilation or linking failed. Perhaps you forgot to add some libraries or some source files? Check your source code and try again." + ) + errexit(f"Failed to execute command '{command}'") + + +def format_number(number: float): + if number.is_integer(): + return str(int(number)).ljust(12) + else: + return f"{number:.12f}".rstrip('0').ljust(12) + +def check_fl32_output(): + output = safe_check_output('fl32.exe') + if "Microsoft (R) Fortran PowerStation" in output: + return True + else: + return False + +def get_line(file: Path, line: int): + with open(file, 'r', encoding='utf-8') as f: + return f.readlines()[line-1] + +@app.command() +def build( + input_files: list[Path] = typer.Argument(help="List of source files and libraries"), + output: Path = typer.Option( + help="Output executable", default=Path("app.exe")), + run: Annotated[ + bool, typer.Option(help="Run the executable after compilation") + ] = False, + friendly: Annotated[bool, typer.Option(help="Convert fortran numbers to friendly format")] = False, + clean: bool = typer.Option(help="Clean build folder after compilation", default=True), + pause: bool = typer.Option(help="Pause after compilation", default=False), +): + """ + Build executable from source files and libraries. + """ + if not check_fl32_output(): + errexit('Microsoft Fortran PowerStation fl32.exe compiler is not installed. Please install it and try again.') + + tmp_folder = Path("build/") + if tmp_folder.exists(): + shutil.rmtree(tmp_folder) + os.mkdir(tmp_folder) + + if not input_files: + errexit("No input files were specified.") + + for file in input_files: + if not file.exists(): + errexit(f'File "{file}" was not found in current directory.') + + f90_files = [file for file in input_files if file.suffix.lower() == ".f90"] + lib_files = [str(file) for file in input_files if file.suffix.lower() == ".lib"] + + info(f'Source files to be compiled: {", ".join(map(str, f90_files))}') + if lib_files: + info(f'Libraries to be linked: {", ".join(lib_files)}') + info(f'Output executable: "{output}"') + + info("Compiling files...") + stats = {} + for f90_file in f90_files: + compile_output = safe_check_output(f'fl32 /c /Fo"build\\{f90_file.stem}" /nologo {f90_file}') + failed = False + for line in compile_output.split('\n'): + match = re.fullmatch('(.+)\(([0-9]+)\): (\S+) (\S+): (.+)', line) + if match: + file, line, info_type, code, message = match.groups() + + if info_type == 'error': + typer.echo(typer.style(f"\nerror: ", fg=typer.colors.RED) + f'{message}, file {file} at line {line} [{code}]') + fl = get_line(Path(file), int(line)).strip() + typer.echo(f'{line} {fl}') + typer.echo(typer.style(f'{" " * len(line)} {"^" * len(fl)}\n', fg=typer.colors.RED)) + failed = True + stats['errors'] = stats.get('errors', 0) + 1 + if info_type == 'warning': + typer.echo(typer.style(f"\nwarning: ", fg=typer.colors.YELLOW) + f'{message}, file {file} at line {line} [{code}]') + fl = get_line(Path(file), int(line)).strip() + typer.echo(f'{line} {fl}') + typer.echo(typer.style(f'{" " * len(line)} {"^" * len(fl)}\n', fg=typer.colors.YELLOW)) + stats['warnings'] = stats.get('warnings', 0) + 1 + + if failed: + errexit(f'Failed to compile "{f90_file}", errors listed above. Check your source code and try again.') + + info("Linking to executable...") + joined_files_with_dist = [ + str(Path("build") / (file.stem + ".obj")) for file in f90_files + ] + try_or_exit( + f'fl32 /nologo {" ".join(joined_files_with_dist)} {" ".join(lib_files)} /Fe"{output}"' + ) + + if clean: + shutil.rmtree(tmp_folder) + + + info(f"Compilation finished to '{output}'. Errors: {stats.get('errors', 0)}, Warnings: {stats.get('warnings', 0)}") + + if run: + info(f'Executing "{output}"...') + hint("If nothing happens, press ENTER to continue...") + if not friendly: + process = Popen([output], stdout=PIPE) + (output, _) = process.communicate() + _ = process.wait() + + output = output.decode("cp866") + print(output) + + if pause: + input('Press ENTER to continue... ') + + sys.exit(0) + info('Running in friendly mode! :)') + process = Popen([output], stdout=PIPE) + (output, _) = process.communicate() + _ = process.wait() + + output = output.decode("cp866") + + for match in re.findall("(\.(\d+)D\+(\d+))", output): + number = float(f"0.{match[1]}") + for _ in range(int(match[2].strip("0") or "0")): + number *= 10 + + output = output.replace(match[0], format_number(number)) + + for match in re.findall("(\.(\d+)D\-(\d+))", output): + number = float(f"0.{match[1]}") + for _ in range(int(match[2].strip("0") or "0")): + number /= 10 + + output = output.replace(match[0], format_number(number)) + + print(output) + + if pause: + input('Press ENTER to continue... ') + + +@app.command() +def version(): + """ + Prints the version of the tool. + """ + print( + "Developed for Moscow Aviation University (MAU) for building legacy Fortran projects with ease. Special for 609 students with love." + ) + +print_header() +app() diff --git a/poetry.lock b/poetry.lock new file mode 100644 index 0000000..bf9834a --- /dev/null +++ b/poetry.lock @@ -0,0 +1,137 @@ +# This file is automatically @generated by Poetry 1.7.1 and should not be changed by hand. + +[[package]] +name = "click" +version = "8.1.7" +description = "Composable command line interface toolkit" +optional = false +python-versions = ">=3.7" +files = [ + {file = "click-8.1.7-py3-none-any.whl", hash = "sha256:ae74fb96c20a0277a1d615f1e4d73c8414f5a98db8b799a7931d1582f3390c28"}, + {file = "click-8.1.7.tar.gz", hash = "sha256:ca9853ad459e787e2192211578cc907e7594e294c7ccc834310722b41b9ca6de"}, +] + +[package.dependencies] +colorama = {version = "*", markers = "platform_system == \"Windows\""} + +[[package]] +name = "colorama" +version = "0.4.6" +description = "Cross-platform colored terminal text." +optional = false +python-versions = "!=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,!=3.5.*,!=3.6.*,>=2.7" +files = [ + {file = "colorama-0.4.6-py2.py3-none-any.whl", hash = "sha256:4f1d9991f5acc0ca119f9d443620b77f9d6b33703e51011c16baf57afb285fc6"}, + {file = "colorama-0.4.6.tar.gz", hash = "sha256:08695f5cb7ed6e0531a20572697297273c47b8cae5a63ffc6d6ed5c201be6e44"}, +] + +[[package]] +name = "markdown-it-py" +version = "3.0.0" +description = "Python port of markdown-it. Markdown parsing, done right!" +optional = false +python-versions = ">=3.8" +files = [ + {file = "markdown-it-py-3.0.0.tar.gz", hash = "sha256:e3f60a94fa066dc52ec76661e37c851cb232d92f9886b15cb560aaada2df8feb"}, + {file = "markdown_it_py-3.0.0-py3-none-any.whl", hash = "sha256:355216845c60bd96232cd8d8c40e8f9765cc86f46880e43a8fd22dc1a1a8cab1"}, +] + +[package.dependencies] +mdurl = ">=0.1,<1.0" + +[package.extras] +benchmarking = ["psutil", "pytest", "pytest-benchmark"] +code-style = ["pre-commit (>=3.0,<4.0)"] +compare = ["commonmark (>=0.9,<1.0)", "markdown (>=3.4,<4.0)", "mistletoe (>=1.0,<2.0)", "mistune (>=2.0,<3.0)", "panflute (>=2.3,<3.0)"] +linkify = ["linkify-it-py (>=1,<3)"] +plugins = ["mdit-py-plugins"] +profiling = ["gprof2dot"] +rtd = ["jupyter_sphinx", "mdit-py-plugins", "myst-parser", "pyyaml", "sphinx", "sphinx-copybutton", "sphinx-design", "sphinx_book_theme"] +testing = ["coverage", "pytest", "pytest-cov", "pytest-regressions"] + +[[package]] +name = "mdurl" +version = "0.1.2" +description = "Markdown URL utilities" +optional = false +python-versions = ">=3.7" +files = [ + {file = "mdurl-0.1.2-py3-none-any.whl", hash = "sha256:84008a41e51615a49fc9966191ff91509e3c40b939176e643fd50a5c2196b8f8"}, + {file = "mdurl-0.1.2.tar.gz", hash = "sha256:bb413d29f5eea38f31dd4754dd7377d4465116fb207585f97bf925588687c1ba"}, +] + +[[package]] +name = "pygments" +version = "2.18.0" +description = "Pygments is a syntax highlighting package written in Python." +optional = false +python-versions = ">=3.8" +files = [ + {file = "pygments-2.18.0-py3-none-any.whl", hash = "sha256:b8e6aca0523f3ab76fee51799c488e38782ac06eafcf95e7ba832985c8e7b13a"}, + {file = "pygments-2.18.0.tar.gz", hash = "sha256:786ff802f32e91311bff3889f6e9a86e81505fe99f2735bb6d60ae0c5004f199"}, +] + +[package.extras] +windows-terminal = ["colorama (>=0.4.6)"] + +[[package]] +name = "rich" +version = "13.8.0" +description = "Render rich text, tables, progress bars, syntax highlighting, markdown and more to the terminal" +optional = false +python-versions = ">=3.7.0" +files = [ + {file = "rich-13.8.0-py3-none-any.whl", hash = "sha256:2e85306a063b9492dffc86278197a60cbece75bcb766022f3436f567cae11bdc"}, + {file = "rich-13.8.0.tar.gz", hash = "sha256:a5ac1f1cd448ade0d59cc3356f7db7a7ccda2c8cbae9c7a90c28ff463d3e91f4"}, +] + +[package.dependencies] +markdown-it-py = ">=2.2.0" +pygments = ">=2.13.0,<3.0.0" + +[package.extras] +jupyter = ["ipywidgets (>=7.5.1,<9)"] + +[[package]] +name = "shellingham" +version = "1.5.4" +description = "Tool to Detect Surrounding Shell" +optional = false +python-versions = ">=3.7" +files = [ + {file = "shellingham-1.5.4-py2.py3-none-any.whl", hash = "sha256:7ecfff8f2fd72616f7481040475a65b2bf8af90a56c89140852d1120324e8686"}, + {file = "shellingham-1.5.4.tar.gz", hash = "sha256:8dbca0739d487e5bd35ab3ca4b36e11c4078f3a234bfce294b0a0291363404de"}, +] + +[[package]] +name = "typer" +version = "0.12.5" +description = "Typer, build great CLIs. Easy to code. Based on Python type hints." +optional = false +python-versions = ">=3.7" +files = [ + {file = "typer-0.12.5-py3-none-any.whl", hash = "sha256:62fe4e471711b147e3365034133904df3e235698399bc4de2b36c8579298d52b"}, + {file = "typer-0.12.5.tar.gz", hash = "sha256:f592f089bedcc8ec1b974125d64851029c3b1af145f04aca64d69410f0c9b722"}, +] + +[package.dependencies] +click = ">=8.0.0" +rich = ">=10.11.0" +shellingham = ">=1.3.0" +typing-extensions = ">=3.7.4.3" + +[[package]] +name = "typing-extensions" +version = "4.12.2" +description = "Backported and Experimental Type Hints for Python 3.8+" +optional = false +python-versions = ">=3.8" +files = [ + {file = "typing_extensions-4.12.2-py3-none-any.whl", hash = "sha256:04e5ca0351e0f3f85c6853954072df659d0d13fac324d0072316b67d7794700d"}, + {file = "typing_extensions-4.12.2.tar.gz", hash = "sha256:1a7ead55c7e559dd4dee8856e3a88b41225abfe1ce8df57b7c13915fe121ffb8"}, +] + +[metadata] +lock-version = "2.0" +python-versions = "^3.10" +content-hash = "a8b347ff4d818c262736c1211b31d62c29e58b723863a9213ab5041ac1d54b74" diff --git a/pyproject.toml b/pyproject.toml new file mode 100644 index 0000000..fa594f3 --- /dev/null +++ b/pyproject.toml @@ -0,0 +1,18 @@ +[tool.poetry] +name = "fortrun" +version = "0.1.0" +description = "" +authors = ["Daniil Irkhin "] +readme = "README.md" + +[tool.poetry.dependencies] +python = "^3.10" +typer = "^0.12.5" + + +[build-system] +requires = ["poetry-core"] +build-backend = "poetry.core.masonry.api" + +[tool.poetry.scripts] +build = 'build:main' \ No newline at end of file diff --git a/setup-readme.txt b/setup-readme.txt new file mode 100644 index 0000000..2d215db --- /dev/null +++ b/setup-readme.txt @@ -0,0 +1,9 @@ +На данном этапе у вас должны быть установлены: + +- Microsoft PowerStation 4.0 +- Visual Studio Code (рекомендуется, но необязательно именно он) +- Прямые лапки + +Работоспособность тестировалась на чистой Windows 11, но должно работать и на 10 и ниже. + +За дополнительной информацией: https://git.dj-haski.ru/Dj_Haski/fortrun \ No newline at end of file diff --git a/setup.iss b/setup.iss new file mode 100644 index 0000000..a73736a --- /dev/null +++ b/setup.iss @@ -0,0 +1,36 @@ +#include "env.iss" + +[Setup] +AppName=fortrun +AppVersion=1.2 +WizardStyle=modern +DefaultDirName={autopf}\fortrun +DisableProgramGroupPage=yes +UninstallDisplayIcon={app}\fortrun.exe +Compression=lzma2 +SolidCompression=yes +ChangesEnvironment=true +LicenseFile=LICENSE +AlwaysRestart=yes +InfoBeforeFile=setup-readme.txt + +[Languages] +Name: "en"; MessagesFile: "compiler:Default.isl" +Name: "ru"; MessagesFile: "compiler:Languages\Russian.isl" + +[Files] +Source: "dist/fortrun.exe"; DestDir: "{app}" + +[Code] + +procedure CurStepChanged(CurStep: TSetupStep); +begin + if CurStep = ssPostInstall + then EnvAddPath(ExpandConstant('{app}')); +end; + +procedure CurUninstallStepChanged(CurUninstallStep: TUninstallStep); +begin + if CurUninstallStep = usPostUninstall + then EnvRemovePath(ExpandConstant('{app}')); +end; \ No newline at end of file