| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 1b43166 commit 26dccd7
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -2,24 +2,22 @@ | |||
| 2 | 2 | ||
| 3 | 3 | import os | |
| 4 | 4 | import sys | |
| 5 | + from pathlib import Path | ||
| 5 | 6 | from typing import Sequence | |
| 6 | 7 | ||
| 7 | 8 | from setuptools import setup, find_packages | |
| 8 | 9 | from setuptools.command.build_py import build_py as _build_py | |
| 9 | 10 | from setuptools.command.sdist import sdist as _sdist | |
| 10 | 11 | ||
| 11 | 12 | ||
| 12 | - with open(os.path.join(os.path.dirname(__file__), "VERSION"), encoding="utf-8") as ver_file: | ||
| 13 | - VERSION = ver_file.readline().strip() | ||
| 13 | + def _read_content(path: str) -> str: | ||
| 14 | + return (Path(__file__).parent / path).read_text(encoding="utf-8") | ||
| 14 | 15 | ||
| 15 | - with open("requirements.txt", encoding="utf-8") as reqs_file: | ||
| 16 | - requirements = reqs_file.read().splitlines() | ||
| 17 | 16 | ||
| 18 | - with open("test-requirements.txt", encoding="utf-8") as reqs_file: | ||
| 19 | - test_requirements = reqs_file.read().splitlines() | ||
| 20 | - | ||
| 21 | - with open("README.md", encoding="utf-8") as rm_file: | ||
| 22 | - long_description = rm_file.read() | ||
| 17 | + version = _read_content("VERSION").strip() | ||
| 18 | + requirements = _read_content("requirements.txt").splitlines() | ||
| 19 | + test_requirements = _read_content("test-requirements.txt").splitlines() | ||
| 20 | + long_description = _read_content("README.md") | ||
| 23 | 21 | ||
| 24 | 22 | ||
| 25 | 23 | class build_py(_build_py): | |
@@ -50,7 +48,7 @@ def _stamp_version(filename: str) -> None: | |||
| 50 | 48 | with open(filename) as f: | |
| 51 | 49 | for line in f: | |
| 52 | 50 | if "__version__ =" in line: | |
| 53 | - line = line.replace('"git"', "'%s'" % VERSION) | ||
| 51 | + line = line.replace('"git"', "'%s'" % version) | ||
| 54 | 52 | found = True | |
| 55 | 53 | out.append(line) | |
| 56 | 54 | except OSError: | |
@@ -66,7 +64,7 @@ def _stamp_version(filename: str) -> None: | |||
| 66 | 64 | setup( | |
| 67 | 65 | name="GitPython", | |
| 68 | 66 | cmdclass={"build_py": build_py, "sdist": sdist}, | |
| 69 | - version=VERSION, | ||
| 67 | + version=version, | ||
| 70 | 68 | description="GitPython is a Python library used to interact with Git repositories", | |
| 71 | 69 | author="Sebastian Thiel, Michael Trier", | |
| 72 | 70 | author_email="byronimo@gmail.com, mtrier@gmail.com", | |
| Back | FazBrowse Home | New Git URL |
0 commit comments