Remove unneeded dependencies from setup.py.

Resolves: rhbz#1082400
This commit is contained in:
Slavek Kabrda 2014-03-31 13:26:55 +02:00
parent f6c10052d1
commit 9b869bc399
2 changed files with 92 additions and 1 deletions

View File

@ -20,7 +20,7 @@
Name: %{?scl_prefix}python-%{pypi_name} Name: %{?scl_prefix}python-%{pypi_name}
Version: 1.2.5 Version: 1.2.5
Release: 1%{?dist} Release: 2%{?dist}
Summary: Assertion toolbox for python Summary: Assertion toolbox for python
License: GPLv3+ License: GPLv3+
@ -33,6 +33,9 @@ Source1: https://raw.github.com/gabrielfalcao/sure/master/COPYING
# git clone https://github.com/gabrielfalcao/sure.git && cd sure # git clone https://github.com/gabrielfalcao/sure.git && cd sure
# git checkout 1.2.5 && tar czf sure-1.2.5-tests.tgz tests/ # git checkout 1.2.5 && tar czf sure-1.2.5-tests.tgz tests/
Source2: %{pypi_name}-%{version}-tests.tgz Source2: %{pypi_name}-%{version}-tests.tgz
# Remove unnecessary dependencies in setup.py which might break
# depending packages builds, https://github.com/gabrielfalcao/sure/pull/57
Patch0: sure-remove-unnecessary-dependencies.patch
BuildArch: noarch BuildArch: noarch
BuildRequires: %{?scl_prefix}python2-devel BuildRequires: %{?scl_prefix}python2-devel
@ -63,6 +66,8 @@ rm -rf %{pypi_name}.egg-info
cp %{SOURCE1} . cp %{SOURCE1} .
tar xzf %{SOURCE2} tar xzf %{SOURCE2}
%patch0 -p1
%if 0%{?with_python3} %if 0%{?with_python3}
rm -rf %{py3dir} rm -rf %{py3dir}
cp -a . %{py3dir} cp -a . %{py3dir}
@ -115,6 +120,10 @@ popd
%endif %endif
%changelog %changelog
* Mon Mar 31 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2.5-2
- Remove unneeded dependencies from setup.py.
Resolves: rhbz#1082400
* Fri Mar 07 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2.5-1 * Fri Mar 07 2014 Bohuslav Kabrda <bkabrda@redhat.com> - 1.2.5-1
- Updated to 1.2.5 - Updated to 1.2.5
- Fix with_python3 macro definition to work correctly on EPEL, too. - Fix with_python3 macro definition to work correctly on EPEL, too.

View File

@ -0,0 +1,82 @@
From 0dbf5a5d4e82afeb7ac379b2e470b46c119285be Mon Sep 17 00:00:00 2001
From: Jamie Lennox <jamielennox@redhat.com>
Date: Mon, 31 Mar 2014 11:27:17 +1000
Subject: [PATCH] Handle setup.py dependencies separate to requirements.txt
The usage of these two files is very different and setup.py should not
have the strict version requirements that requirements.txt does
otherwise we create dependency problems for packagers and people using
the library.
Also changes the existing dependencies from install requirements to test
requirements and registered nose as the test handler in setup.py.
Fixes Issue #56
---
setup.py | 35 +++--------------------------------
1 file changed, 3 insertions(+), 32 deletions(-)
diff --git a/setup.py b/setup.py
index 3b97afb..8b81d53 100755
--- a/setup.py
+++ b/setup.py
@@ -18,7 +18,6 @@
import ast
import os
-import re
from setuptools import setup, find_packages
@@ -42,39 +41,11 @@ def read_version():
return finder.version
-def parse_requirements(path):
- """Rudimentary parser for the `requirements.txt` file
-
- We just want to separate regular packages from links to pass them to the
- `install_requires` and `dependency_links` params of the `setup()`
- function properly.
- """
- try:
- requirements = map(str.strip, local_file(path).splitlines())
- except IOError:
- raise RuntimeError("Couldn't find the `requirements.txt' file :(")
-
- links = []
- pkgs = []
- for req in requirements:
- if not req:
- continue
- if 'http:' in req or 'https:' in req:
- links.append(req)
- name, version = re.findall("\#egg=([^\-]+)-(.+$)", req)[0]
- pkgs.append('{0}=={1}'.format(name, version))
- else:
- pkgs.append(req)
-
- return pkgs, links
-
-
local_file = lambda *f: \
open(os.path.join(os.path.dirname(__file__), *f)).read()
-install_requires, dependency_links = \
- parse_requirements('requirements.txt')
+tests_require = ['nose']
if __name__ == '__main__':
@@ -87,6 +58,6 @@ def parse_requirements(path):
include_package_data=True,
url='http://github.com/gabrielfalcao/sure',
packages=find_packages(exclude=['*tests*']),
- install_requires=install_requires,
- dependency_links=dependency_links,
+ tests_require=tests_require,
+ test_suite='nose.collector',
)
--
1.8.5.5