Skip to content

Commit 2005857

Browse files
committed
fix python packaging using latest methods
- Change python packaging method following instructions from https://packaging.python.org/en/latest/tutorials/packaging-projects/ - Remove scripts as they can be created automatically from setup.cfg - move the sources to src - setup.py: remove captialization in package names, conflicts with other packaging methods like debian's - modify licence to gpl3+ - Add setup.cfg and pyproject.toml - modify MANIFEST.in to include assets - WoeUSB-ng.desktop: add version and change icon
1 parent bcb7583 commit 2005857

File tree

31 files changed

+55
-131
lines changed

31 files changed

+55
-131
lines changed

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
\.idea/
55
doc/_build
66
venv/
7-
WoeUSB_ng\.egg-info/
7+
*.egg-info*
88
dist/
99

1010
build/

MANIFEST.in

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
graft WoeUSB/data
2-
graft WoeUSB/locale
1+
graft src/WoeUSB/data*
2+
graft src/WoeUSB/locale*
33
graft miscellaneous
44
include README.md
5-
include WoeUSB/woeusbgui

WoeUSB/woeusb

Lines changed: 0 additions & 27 deletions
This file was deleted.

WoeUSB/woeusbgui

Lines changed: 0 additions & 40 deletions
This file was deleted.

miscellaneous/WoeUSB-ng.desktop

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
#!/usr/bin/env xdg-open
21
[Desktop Entry]
2+
Version=1.0
33
Name=WoeUSB-ng
44
Exec=woeusbgui
5-
Icon=/usr/share/icons/WoeUSB-ng/icon.ico
5+
Icon=woeusb-logo
66
Terminal=false
77
Type=Application
88
Categories=Utility;

pyproject.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
[build-system]
2+
requires = ["setuptools>=42"]
3+
build-backend = "setuptools.build_meta"

setup.cfg

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
[metadata]
2+
name = woeusb-ng
3+
version = 0.2.10
4+
author = Jakub Szymański
5+
author_email = [email protected]
6+
description = WoeUSB-ng is a simple tool that enable you to create your own usb stick windows installer from an iso image or a real DVD. This is a rewrite of original WoeUSB.
7+
long_description = file: README.md
8+
long_description_content_type = text/markdown
9+
url = https://github.com/WoeUSB/WoeUSB-ng
10+
project_urls =
11+
Bug Tracker = https://github.com/WoeUSB/WoeUSB-ng/issues
12+
classifiers =
13+
Development Status :: 5 - Production/Stable
14+
Environment :: X11 Applications :: GTK
15+
Intended Audience :: End Users/Desktop
16+
License :: OSI Approved
17+
:: GNU General Public License v3 or later (GPLv3+)
18+
Operating System :: POSIX
19+
Programming Language :: Python
20+
Programming Language :: Python :: 3
21+
Programming Language :: Python :: 3.5
22+
Programming Language :: Python :: 3.6
23+
Programming Language :: Python :: 3.7
24+
Programming Language :: Python :: 3.8
25+
Programming Language :: Python :: 3 :: Only
26+
Topic :: System :: Operating System
27+
28+
[options]
29+
package_dir =
30+
= src
31+
packages = find:
32+
python_requires = >=3.6
33+
include_package_data = True
34+
35+
[options.packages.find]
36+
where = src
37+
38+
[options.entry_points]
39+
gui_scripts =
40+
woeusbgui = WoeUSB.gui:run
41+
console_scripts =
42+
woeusb = WoeUSB.core:run

setup.py

Lines changed: 5 additions & 58 deletions
Original file line numberDiff line numberDiff line change
@@ -1,73 +1,20 @@
11
import os
2-
import shutil
3-
import stat
42

53
from setuptools import setup
6-
from setuptools.command.develop import develop
7-
from setuptools.command.install import install
84

95
this_directory = os.path.abspath(os.path.dirname(__file__))
106

117
with open(os.path.join(this_directory, 'README.md'), encoding='utf-8') as f:
128
long_description = f.read()
139

14-
15-
def post_install():
16-
path = '/usr/local/bin/woeusbgui' # I give up, I have no clue how to get bin path that is used by pip
17-
shutil.copy2(this_directory + '/WoeUSB/woeusbgui', path) # I'll just hard code it until someone finds better way
18-
19-
shutil.copy2(this_directory + '/miscellaneous/com.github.woeusb.woeusb-ng.policy', "/usr/share/polkit-1/actions")
20-
21-
try:
22-
os.makedirs('/usr/share/icons/WoeUSB-ng')
23-
except FileExistsError:
24-
pass
25-
26-
shutil.copy2(this_directory + '/WoeUSB/data/icon.ico', '/usr/share/icons/WoeUSB-ng/icon.ico')
27-
shutil.copy2(this_directory + '/miscellaneous/WoeUSB-ng.desktop', "/usr/share/applications/WoeUSB-ng.desktop")
28-
29-
os.chmod('/usr/share/applications/WoeUSB-ng.desktop',
30-
stat.S_IRUSR | stat.S_IWUSR | stat.S_IRGRP | stat.S_IROTH | stat.S_IEXEC) # 755
31-
32-
33-
class PostDevelopCommand(develop):
34-
"""Post-installation for development mode."""
35-
36-
def run(self):
37-
# TODO
38-
develop.run(self)
39-
40-
41-
class PostInstallCommand(install):
42-
"""Post-installation for installation mode."""
43-
44-
def run(self):
45-
post_install()
46-
install.run(self)
47-
48-
4910
setup(
50-
name='WoeUSB-ng',
51-
version='0.2.10',
52-
description='WoeUSB-ng is a simple tool that enable you to create your own usb stick windows installer from an iso image or a real DVD. This is a rewrite of original WoeUSB. ',
53-
long_description=long_description,
54-
long_description_content_type='text/markdown',
55-
url='https://github.com/WoeUSB/WoeUSB-ng',
56-
author='Jakub Szymański',
57-
author_email='[email protected]',
58-
license='GPL-3',
59-
zip_safe=False,
60-
packages=['WoeUSB'],
61-
include_package_data=True,
62-
scripts=[
63-
'WoeUSB/woeusb',
11+
data_files=[
12+
("share/applications", ["miscellaneous/WoeUSB-ng.desktop"]),
13+
("share/polkit-1/actions", ["miscellaneous/com.github.woeusb.woeusb-ng.policy"]),
14+
("share/icons/hicolor/scalable/apps", ["src/WoeUSB/data/woeusb-logo.png"]),
6415
],
6516
install_requires=[
6617
'termcolor',
6718
'wxPython',
68-
],
69-
cmdclass={
70-
'develop': PostDevelopCommand,
71-
'install': PostInstallCommand
72-
}
19+
]
7320
)
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)