Skip to content

Commit e99be0a

Browse files
committed
refactor setup
1 parent cd1ea2a commit e99be0a

File tree

6 files changed

+117
-104
lines changed

6 files changed

+117
-104
lines changed

MANIFEST.in

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
2+
global-include *LICENSE* *.txt *.md *.rst
3+
recursive-include src/deliver/gui/resources/images *.svg *.png
4+
recursive-include src/deliver/gui/resources/fonts *.ttf
5+
include src/deliver/gui/resources/*.qss
6+
include src/deliver/rezplugins/*/rezconfig
7+
include pyproject.toml

setup.cfg

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,85 @@
1+
[metadata]
2+
name = rez-deliver
3+
version = attr: deliver._version.__version__
4+
description = Rez package deployment tool
5+
long_description = file: README.md
6+
long_description_content_type = text/markdown
7+
url = https://github.com/davidlatwe/rez-deliver
8+
author = davidlatwe
9+
author_email = [email protected]
10+
maintainer = davidlatwe
11+
maintainer_email = [email protected]
12+
license = LGPLv3
13+
license_file = LICENSE
14+
platforms = any
15+
classifiers =
16+
Development Status :: 4 - Beta
17+
Intended Audience :: Developers
18+
License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)
19+
Operating System :: MacOS :: MacOS X
20+
Operating System :: Microsoft :: Windows
21+
Operating System :: POSIX
22+
Programming Language :: Python :: 3
23+
Programming Language :: Python :: 3.6
24+
Programming Language :: Python :: 3.7
25+
Programming Language :: Python :: 3.8
26+
Programming Language :: Python :: 3.9
27+
Programming Language :: Python :: Implementation :: CPython
28+
Topic :: Utilities
29+
Topic :: Software Development
30+
Topic :: System :: Software Distribution
31+
keywords = package resolve version build install software management
32+
project_urls =
33+
Source=https://github.com/davidlatwe/rez-deliver
34+
Tracker=https://github.com/davidlatwe/rez-deliver/issues
35+
36+
[options]
37+
zip_safe = true
38+
python_requires = >=3, !=3.0.*, !=3.1.*, !=3.2.*, !=3.3.*
39+
install_requires =
40+
pygithub
41+
requests==2.24.0
42+
packages = find:
43+
package_dir =
44+
= src
45+
include_package_data = true
46+
47+
[options.packages.find]
48+
where = src
49+
exclude =
50+
tests
51+
52+
[options.entry_points]
53+
console_scripts =
54+
rez-deliver=deliver._entry_points:run_rez_deliver
55+
56+
[options.package_data]
57+
deliver.rezplugins = */rezconfig
58+
deliver.gui =
59+
resources/*.qss
60+
resources/images/*.svg
61+
resources/images/*.png
62+
resources/fonts/*/*.ttf
63+
resources/fonts/*/*LICENSE*
64+
65+
[options.extras_require]
66+
gui =
67+
qt5.py
68+
pyside2
69+
tests =
70+
pytest
71+
72+
[sdist]
73+
formats = gztar
74+
75+
[bdist_wheel]
76+
universal = true
77+
78+
[tool:pytest]
79+
markers =
80+
slow
81+
junit_family = xunit2
82+
addopts = --tb=auto -ra --showlocals --no-success-flaky-report
83+
env =
84+
PYTHONWARNINGS=ignore:DEPRECATION::pip._internal.cli.base_command
85+
PYTHONIOENCODING=utf-8

setup.py

Lines changed: 2 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -1,79 +1,3 @@
1-
from __future__ import print_function, with_statement
21

3-
import os
4-
import sys
5-
import fnmatch
6-
from setuptools import setup, find_packages
7-
8-
9-
# carefully import some sourcefiles that are standalone
10-
source_path = os.path.dirname(os.path.realpath(__file__))
11-
src_path = os.path.join(source_path, "src")
12-
sys.path.insert(0, src_path)
13-
14-
from deliver._version import version
15-
16-
17-
def find_files(pattern, path=None, root="deliver", prefix=""):
18-
paths = []
19-
basepath = os.path.realpath(os.path.join("src", root))
20-
path_ = basepath
21-
if path:
22-
path_ = os.path.join(path_, path)
23-
24-
for root, _, files in os.walk(path_):
25-
files = [x for x in files if fnmatch.fnmatch(x, pattern)]
26-
files = [os.path.join(root, x) for x in files]
27-
paths += [x[len(basepath):].lstrip(os.path.sep) for x in files]
28-
29-
return [prefix + p for p in paths]
30-
31-
32-
with open(os.path.join(source_path, "README.md")) as f:
33-
long_description = f.read()
34-
35-
36-
setup(
37-
name="rez-deliver",
38-
package_data={
39-
"deliver":
40-
find_files("rezconfig") +
41-
find_files("*.ttf", "gui/resources/fonts") +
42-
find_files("*.svg", "gui/resources/images") +
43-
find_files("*.svg", "gui/resources/images") +
44-
find_files("*.png", "gui/resources/images") +
45-
find_files("*.qss", "gui/resources") +
46-
find_files("LICENSE.*") +
47-
find_files("LICENSE")
48-
},
49-
install_requires=[
50-
"pygithub",
51-
"requests==2.24.0",
52-
],
53-
extras_require={
54-
"gui": ["qt5.py", "pyside2"],
55-
},
56-
packages=find_packages("src"),
57-
package_dir={"": "src"},
58-
include_package_data=True,
59-
zip_safe=False,
60-
license="LGPL",
61-
author="davidlatwe",
62-
author_email="[email protected]",
63-
version=version,
64-
description="Rez cli for releasing packages from GitHub repositories",
65-
long_description=long_description,
66-
classifiers=[
67-
"Development Status :: 5 - Production/Stable",
68-
"License :: OSI Approved :: GNU Lesser General Public License v3 (LGPLv3)",
69-
"Intended Audience :: Developers",
70-
"Operating System :: OS Independent",
71-
"Programming Language :: Python",
72-
"Programming Language :: Python :: 3",
73-
"Programming Language :: Python :: 3.6",
74-
"Programming Language :: Python :: 3.7",
75-
"Programming Language :: Python :: 3.8",
76-
"Topic :: Software Development",
77-
"Topic :: System :: Software Distribution"
78-
],
79-
)
2+
from setuptools import setup
3+
setup()

src/deliver/_entry_points.py

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,5 @@
11

2-
import sys
32

4-
5-
def get_specifications():
6-
specs = {}
7-
for attr, obj in sys.modules[__name__].__dict__.items():
8-
script = getattr(obj, "__scriptname__", None)
9-
if script:
10-
spec = "%s = %s:%s" % (script, __name__, attr)
11-
specs[script] = spec
12-
return specs
13-
14-
15-
def scriptname(name):
16-
def decorator(fn):
17-
setattr(fn, "__scriptname__", name)
18-
return fn
19-
return decorator
20-
21-
22-
# Entry points
23-
24-
@scriptname("rez-deliver")
253
def run_rez_deliver():
264
from rez.cli._main import run
275
return run("deliver")

src/deliver/_version.py

Lines changed: 20 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,21 @@
11

2-
version = "0.1.0"
2+
__version__ = "0.1.0"
3+
4+
5+
def package_info():
6+
import deliver
7+
return dict(
8+
name=deliver.__package__,
9+
version=__version__,
10+
path=deliver.__path__[0],
11+
)
12+
13+
14+
def print_info():
15+
import sys
16+
info = package_info()
17+
py = sys.version_info
18+
print(info["name"],
19+
info["version"],
20+
"from", info["path"],
21+
"(python {x}.{y})".format(x=py.major, y=py.minor))

src/deliver/rezplugins/command/deliver.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
"""
22
Rez developer package delivering tool
33
"""
4+
import sys
45
from rez.command import Command
56

67

@@ -30,15 +31,14 @@ def setup_parser(parser, completions=False):
3031

3132
def command(opts, parser=None, extra_arg_groups=None):
3233
from rez.config import config
33-
from deliver._version import version
3434
from deliver import cli
3535

3636
# TODO: ensure vcs plugin "kit" is loaded on package release
3737
# TODO: This deploy script requires to be in rez venv
3838

3939
if opts.version:
40-
print(version)
41-
return
40+
from deliver._version import print_info
41+
sys.exit(print_info())
4242

4343
if opts.gui:
4444
from deliver.gui import cli as gui

0 commit comments

Comments
 (0)