commit c127b3398df3c0e7afee16834fa125e580544f5f Author: Ilia Miheev Date: Tue Jul 22 18:35:10 2025 +0300 Первый коммит diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..7a25962 --- /dev/null +++ b/.gitignore @@ -0,0 +1,5 @@ +venv/ +test.* +test/ +ideas.md +*.exe diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..d81be48 --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +MIT License + +Copyright (c) 2025 Ilia Miheev + +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: + +1. The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +2. 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 new file mode 100644 index 0000000..3f11aec --- /dev/null +++ b/README.md @@ -0,0 +1,27 @@ +# Приложение для создания exe файла из .py + +Приложение позволяет создать оконное приложение в одном файле и добавить в иконку. + +## Скачать +```bash +pip install icreate-exe +``` + +## Использование + +```bash +icreate-exe [-h] [-i] name_file +``` + +1. **-h**: Выведет справочную информацию + +2. **-i**: Путь до иконки +4. **name_file**: путь до файла .py + +## Пример использования + + +Смотреть пример использования можно по ссылке diff --git a/icreateExe/__init__.py b/icreateExe/__init__.py new file mode 100644 index 0000000..6314302 --- /dev/null +++ b/icreateExe/__init__.py @@ -0,0 +1 @@ +__autor__='Ilia Miheev' \ No newline at end of file diff --git a/icreateExe/icreateExe.py b/icreateExe/icreateExe.py new file mode 100644 index 0000000..c4a53b7 --- /dev/null +++ b/icreateExe/icreateExe.py @@ -0,0 +1,44 @@ +from argparse import ArgumentParser +import sys +import os +import shutil +import glob + +class CustomArgumentParser(ArgumentParser): + def error(self, message): + self.print_usage(sys.stderr) + print(f"Ошибка: {message}", file=sys.stderr) + sys.exit(1) + +def icreateExe(): + # Получаем аргументы из командной строки + parser = CustomArgumentParser(description="Код для создания exe файла из .py") + parser.add_argument('-i', help='Путь до иконки') + parser.add_argument('name_file', help='Путь до файла') + args = parser.parse_args() + + # Выполняем комманду pyinstaller + path_to_icon = args.i + path_to_file = args.name_file + if path_to_icon is None: + command = f'pyinstaller --noconfirm --onefile --windowed {path_to_file}' + else: + command = f'pyinstaller --noconfirm --onefile --windowed --icon {path_to_icon} {path_to_file}' + os.system(command) + + exe_file = os.listdir('./dist/')[0] + # Удаляем файлы + if os.name == 'nt': # Windows + os.system('move .\\dist\\* .\\') + os.system('rmdir /s /q build dist') + os.system('del *.spec') + else: # Unix-системы (Linux, macOS) + os.system('mv ./dist/* ./') + shutil.rmtree('build', ignore_errors=True) + shutil.rmtree('dist', ignore_errors=True) + for spec_file in glob.glob('*.spec'): + os.remove(spec_file) + print(f'\nФайл {exe_file} был создан') + +if __name__ == "__main__": + icreateExe() diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..9f22358 --- /dev/null +++ b/setup.py @@ -0,0 +1,21 @@ +from setuptools import setup, find_packages + +setup( + name='icreate-exe', + version='1.0.0', + description='Приложение для создания exe файла из .py', + long_description=open('./README.md', encoding='utf8').read(), + long_description_content_type='text/markdown', + author='Ilia Miheev', + author_email='strict-swept-unify@duck.com', + packages=find_packages(), + license='MIT', + install_requires=[ + 'pyinstaller' + ], + entry_points={ + 'console_scripts': [ + 'icreate-exe=icreateExe.icreateExe:icreateExe', + ], + }, +) diff --git a/video.mp4 b/video.mp4 new file mode 100644 index 0000000..6a88681 Binary files /dev/null and b/video.mp4 differ