Commits

Jeffrey Goettsch  committed 221db60

Fixed bug where install failed when requests was not previously installed.

  • Participants
  • Parent commits 16b58ea

Comments (0)

Files changed (4)

File pushnotify/__init__.py

 
 import logging
 
+from _version import __version__
 import nma
 import prowl
 import pushover
 
 
-__version__ = '0.5p'
-
 logger = logging.getLogger(__package__)
 
 

File pushnotify/_version.py

+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+#
+# Copyright (C) 2013 Jeffrey Goettsch and other contributors.
+#
+# py-pushnotify is free software: you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation, either version 3 of the License, or
+# (at your option) any later version.
+#
+# py-pushnotify is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with py-pushnotify.  If not, see <http://www.gnu.org/licenses/>.
+
+
+__version__ = '0.5p'

File requirements.txt

-requests==1.1.0
 # along with py-pushnotify.  If not, see <http://www.gnu.org/licenses/>.
 
 
+import os
 import re
 from setuptools import setup
 
-from pushnotify import __version__
 
-
-def parse_requirements(file_name):
-
-    requirements = []
-    for line in open(file_name, 'r').read().split('\n'):
-        if re.match(r'(\s*#)|(\s*$)', line):
-            continue
-        if re.match(r'\s*-e\s+', line):
-            requirements.append(re.sub(r'\s*-e\s+.*#egg=(.*))$', r'\1', line))
-        elif re.match(r'\s*-f\s+', line):
-            pass
-        else:
-            requirements.append(line)
-
-    return requirements
-
-
-def parse_dependency_links(file_name):
-
-    dependency_links = []
-    for line in open(file_name, 'r').read().split('\n'):
-        if re.match(r'\s*-[ef]\s+', line):
-            dependency_links.append(re.sub(r'\s*-[ef]\s+', '', line))
-
-    return dependency_links
-
+versionfile = os.path.join('pushnotify', '_version.py')
+versionline = open(versionfile, 'r').read()
+versionline_re = r'^__version__ = [\'"]([^\'"]*)[\'"]'
+match = re.search(versionline_re, versionline, re.M)
+if match:
+    __version__ = match.group(1)
+else:
+    raise RuntimeError('Version string not found in pushnotify.')
 
 with open('README.rst') as fh:
     long_description = fh.read()
     name='pushnotify',
     packages=['pushnotify', 'pushnotify.tests'],
     version=__version__,
-    install_requires=parse_requirements('requirements.txt'),
-    dependency_links=parse_dependency_links('requirements.txt'),
+    install_requires=['requests==1.1.0'],
 
     # PyPI metadata
+
     author='Jeffrey Goettsch',
     author_email='jgoettsch+pypushnotify@gmail.com',
     classifiers=[