mirror of
https://github.com/gentoo-mirror/gentoo.git
synced 2026-02-09 13:37:42 -08:00
45 lines
1.3 KiB
Diff
45 lines
1.3 KiB
Diff
From b874c25b08edd6bdbdd70a439c6cd603d6830226 Mon Sep 17 00:00:00 2001
|
|
From: Zac Medico <zmedico@gentoo.org>
|
|
Date: Fri, 21 Apr 2017 08:36:14 -0700
|
|
Subject: [PATCH] setup.py: require pytest-runner only when necessary (#119)
|
|
|
|
This optimizes setup.py for cases when pytest-runner is not needed,
|
|
using the approach that is suggested upstream:
|
|
|
|
https://pypi.python.org/pypi/pytest-runner#conditional-requirement
|
|
---
|
|
setup.py | 7 ++++++-
|
|
1 file changed, 6 insertions(+), 1 deletion(-)
|
|
|
|
diff --git a/setup.py b/setup.py
|
|
index 28a080a..c214352 100755
|
|
--- a/setup.py
|
|
+++ b/setup.py
|
|
@@ -1,9 +1,14 @@
|
|
#!/usr/bin/env python
|
|
import re
|
|
+import sys
|
|
|
|
from setuptools import find_packages, setup
|
|
|
|
|
|
+needs_pytest = set(['pytest', 'test', 'ptr']).intersection(sys.argv)
|
|
+pytest_runner = ['pytest-runner'] if needs_pytest else []
|
|
+
|
|
+
|
|
# Get version without importing, which avoids dependency issues
|
|
def get_version():
|
|
with open('chardet/version.py') as version_file:
|
|
@@ -46,7 +51,7 @@ setup(name='chardet',
|
|
"Modules"),
|
|
"Topic :: Text Processing :: Linguistic"],
|
|
packages=find_packages(),
|
|
- setup_requires=['pytest-runner'],
|
|
+ setup_requires=pytest_runner,
|
|
tests_require=['pytest', 'hypothesis'],
|
|
entry_points={'console_scripts':
|
|
['chardetect = chardet.cli.chardetect:main']})
|
|
--
|
|
2.12.2
|
|
|