Первый коммит
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
venv/
|
||||
test.*
|
||||
test/
|
||||
ideas.md
|
||||
*.exe
|
||||
@@ -0,0 +1,21 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2025 Ilia Miheev <strict-swept-unify@duck.com>
|
||||
|
||||
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.
|
||||
@@ -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
|
||||
|
||||
## Пример использования
|
||||
<video width="320" height="240" controls>
|
||||
<source src="./video.mp4" type="video/mp4">
|
||||
Ваш браузер не поддерживает видео.
|
||||
</video>
|
||||
|
||||
Смотреть пример использования можно по <a href='https://drive.google.com/file/d/11qmZz5eXj-iMSqd1KVfKQqDbOq9S0HqH/view?usp=sharing'>ссылке</a>
|
||||
@@ -0,0 +1 @@
|
||||
__autor__='Ilia Miheev'
|
||||
@@ -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()
|
||||
@@ -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',
|
||||
],
|
||||
},
|
||||
)
|
||||
Reference in New Issue
Block a user