-
Notifications
You must be signed in to change notification settings - Fork 5
/
setup.py
44 lines (36 loc) · 1.24 KB
/
setup.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
from setuptools import setup
import os
from pathlib import Path
from subprocess import check_call
from setuptools.command.build_py import build_py
from setuptools.command.develop import develop
def build_icons(target_dir):
icons_pyqt5 = target_dir / '_icons_pyqt5.py'
icons_pyside2 = target_dir / '_icons_pyside2.py'
qrc_file = Path('icons', 'icons.qrc')
check_call(['pyrcc5', '-o', str(icons_pyqt5), str(qrc_file)])
check_call(['pyside2-rcc', '-o', str(icons_pyside2), str(qrc_file)])
class custom_build_py(build_py):
def run(self):
if not self.dry_run:
target_dir = Path(self.build_lib) / 'qtutils' / 'icons'
target_dir.mkdir(parents=True, exist_ok=True)
build_icons(target_dir)
super().run()
class custom_develop(develop):
def run(self):
if not self.dry_run:
target_dir = Path('.') / 'qtutils' / 'icons'
self.mkpath(str(target_dir))
build_icons(target_dir)
super().run()
setup(
use_scm_version={
"version_scheme": "release-branch-semver",
"local_scheme": os.getenv("SCM_LOCAL_SCHEME", "node-and-date"),
},
cmdclass={
'build_py': custom_build_py,
'develop': custom_develop,
},
)