Skip to content

Commit dcd150f

Browse files
committed
Fix warnings and errors with setup
Fix man files not being included. Fix deprecation warnings related to licenses field and packages. Fix git revision not being found correctly because setup.py is executed in a tmp directory. Instead find the revision in the makefile and pass it into setup. Topic: fixes Reviewers: brian-k, aaron
1 parent 07b7b91 commit dcd150f

File tree

3 files changed

+15
-29
lines changed

3 files changed

+15
-29
lines changed

Makefile

+4-3
Original file line numberDiff line numberDiff line change
@@ -37,12 +37,13 @@ clean:
3737
rm -rf $(BUILD_DIR)
3838
rm -rf .mypy_cache
3939

40-
package: man
41-
$(PYTHON) -m build --outdir $(BUILD_DIR)
42-
4340
REVUP_VERSION:=$(shell $(PYTHON) revup/__init__.py)
4441
REVUP_DATE ?= Apr 21, 2021
4542
REVUP_HEADER=---\ntitle: TITLE\nsection: 1\nheader: Revup Manual\nfooter: revup VERSION\ndate: DATE\n---\n
43+
REVUP_VERSION_HASH?=${shell git rev-parse --short v$(REVUP_VERSION) || echo main}
44+
45+
package: man
46+
REVUP_VERSION_HASH=$(REVUP_VERSION_HASH) $(PYTHON) -m build --outdir $(BUILD_DIR)
4647

4748
install:
4849
$(PYTHON) -m pip install build/revup-$(REVUP_VERSION)-py3-none-any.whl --force-reinstall

setup.cfg

+6-4
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,8 @@ author_email = [email protected]
66
description = Revolutionary github tools. Effortlessly create multiple branches and pull requests.
77
keywords = github python git workflow version-control python3 developer-tools code-review pull-requests developers developer-productivity stacked-diffs
88
license = MIT
9-
license_file = LICENSE
9+
license_files =
10+
LICENSE
1011
long_description_content_type = text/markdown
1112
url = https://github.com/skydio/revup
1213
project_urls =
@@ -32,8 +33,9 @@ classifiers =
3233

3334
[options]
3435
package_dir =
35-
revup = revup
36-
packages = find:
36+
= .
37+
packages =
38+
revup
3739
python_requires = >=3.8
3840
install_requires =
3941
aiohttp
@@ -59,7 +61,7 @@ dev =
5961
where = .
6062

6163
[options.package_data]
62-
revup = *.1.gz
64+
revup = man1/*.1.gz
6365

6466
[options.entry_points]
6567
console_scripts =

setup.py

+5-22
Original file line numberDiff line numberDiff line change
@@ -1,29 +1,9 @@
1+
import os
12
import re
2-
import subprocess
33
from pathlib import Path
44

55
from setuptools import setup
66

7-
# Populates the __version__ variable
8-
with open("revup/__init__.py") as f:
9-
exec(f.read())
10-
11-
12-
def tag_rev() -> str:
13-
"""
14-
Get the git sha of the current version from the tag
15-
"""
16-
try:
17-
result = subprocess.run(
18-
["git", "rev-parse", "--short", f"v{__version__}"],
19-
check=True,
20-
text=True,
21-
stdout=subprocess.PIPE,
22-
)
23-
return result.stdout.strip()
24-
except subprocess.CalledProcessError:
25-
return "main"
26-
277

288
def fixed_readme() -> str:
299
"""
@@ -39,10 +19,13 @@ def fixed_readme() -> str:
3919
flags=re.MULTILINE | re.DOTALL,
4020
)
4121

22+
# Git hash of the commit tagged with the current version. Set by Makefile.
23+
revup_version_hash = os.environ.get("REVUP_VERSION_HASH", "main")
24+
4225
# Replace relative links with absolute, so images appear correctly on PyPI
4326
readme = readme.replace(
4427
"docs/images/",
45-
f"https://raw.githubusercontent.com/skydio/revup/{tag_rev()}/docs/images/",
28+
f"https://raw.githubusercontent.com/skydio/revup/{revup_version_hash}/docs/images/",
4629
)
4730

4831
return readme

0 commit comments

Comments
 (0)