|
1 | 1 | import os
|
| 2 | +import sys |
| 3 | + |
2 | 4 | from setuptools import setup, find_packages
|
3 | 5 |
|
| 6 | + |
| 7 | +def get_version(): |
| 8 | + sys.path.insert(os.path.dirname(__file__)) |
| 9 | + import PyQt5 |
| 10 | + return PyQt5.__version__ |
| 11 | + |
| 12 | + |
| 13 | +def get_package_data(): |
| 14 | + package_data = dict() |
| 15 | + |
| 16 | + package_data['PyQt5'] = list() |
| 17 | + for subdir in ("plugins/", "qml/", "uic/"): |
| 18 | + abspath = os.path.abspath("PyQt5/" + subdir) |
| 19 | + for root, dirs, files in os.walk(abspath): |
| 20 | + for f in files: |
| 21 | + fpath = os.path.join(root, f) |
| 22 | + relpath = os.path.relpath(fpath, abspath) |
| 23 | + relpath = relpath.replace("\\", "/") |
| 24 | + package_data['PyQt5'].append(subdir + relpath) |
| 25 | + |
| 26 | + package_data['PyQt5'].extend(["*.exe", "*.dll", "*.pyd"]) |
| 27 | + return package_data |
| 28 | + |
| 29 | + |
4 | 30 | classifiers = [
|
5 | 31 | 'Intended Audience :: Developers',
|
6 | 32 | 'License :: OSI Approved :: GNU General Public License v3 (GPLv3)',
|
|
12 | 38 | ]
|
13 | 39 |
|
14 | 40 |
|
15 |
| -package_data = dict() |
16 |
| - |
17 |
| -package_data['PyQt5'] = list() |
18 |
| -for subdir in ("plugins/", "qml/", "uic/"): |
19 |
| - abspath = os.path.abspath("PyQt5/" + subdir) |
20 |
| - for root, dirs, files in os.walk(abspath): |
21 |
| - for f in files: |
22 |
| - fpath = os.path.join(root, f) |
23 |
| - relpath = os.path.relpath(fpath, abspath) |
24 |
| - relpath = relpath.replace("\\", "/") |
25 |
| - package_data['PyQt5'].append(subdir + relpath) |
26 |
| - |
27 |
| -package_data['PyQt5'].extend(["*.exe", "*.dll", "*.pyd"]) |
28 |
| - |
29 | 41 | setup(
|
30 | 42 | name='pypiqt5', # To avoid name-clash with existing PyQt5
|
31 |
| - version="0.1.1", |
| 43 | + version=get_version(), |
32 | 44 | description='PyQt5',
|
33 | 45 | long_description="pypiqt5",
|
34 | 46 | author='Marcus Ottosson',
|
|
38 | 50 | packages=find_packages(),
|
39 | 51 | zip_safe=False,
|
40 | 52 | classifiers=classifiers,
|
41 |
| - package_data=package_data |
| 53 | + package_data=get_package_data() |
42 | 54 | )
|
0 commit comments