mirror of
https://github.com/vikstrous/pirate-get
synced 2025-01-09 09:59:51 +01:00
Merge pull request #87 from vikstrous/version-check
move version check to setup.py
This commit is contained in:
commit
ea8a2f5d2f
@ -1,9 +1,4 @@
|
||||
import sys
|
||||
from distutils.version import LooseVersion
|
||||
if LooseVersion(sys.version) < LooseVersion("3.4.0"):
|
||||
print("At least python 3.4.0 required. Your version is "+sys.version)
|
||||
sys.exit(1)
|
||||
|
||||
import re
|
||||
import os
|
||||
import argparse
|
||||
|
57
setup.py
57
setup.py
@ -1,27 +1,36 @@
|
||||
#!/usr/bin/env python3
|
||||
from setuptools import setup, find_packages
|
||||
from distutils.version import LooseVersion
|
||||
import sys
|
||||
|
||||
setup(name='pirate-get',
|
||||
version='0.2.8',
|
||||
description='A command line interface for The Pirate Bay',
|
||||
url='https://github.com/vikstrous/pirate-get',
|
||||
author='vikstrous',
|
||||
author_email='me@viktorstanchev.com',
|
||||
license='AGPL',
|
||||
packages=find_packages(),
|
||||
package_data={'': ["data/*.json"]},
|
||||
entry_points={
|
||||
'console_scripts': ['pirate-get = pirate.pirate:main']
|
||||
},
|
||||
install_requires=['colorama>=0.3.3', 'beautifulsoup4>=4.4.1', 'veryprettytable>=0.8.1'],
|
||||
keywords=['torrent', 'magnet', 'download', 'tpb', 'client'],
|
||||
classifiers=[
|
||||
'Topic :: Utilities',
|
||||
'Topic :: Terminals',
|
||||
'Topic :: System :: Networking',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||
],
|
||||
test_suite='tests',
|
||||
)
|
||||
if LooseVersion(sys.version) < LooseVersion("3.4.0"):
|
||||
print("pirate-get requires at least python 3.4.0."
|
||||
" Your version is %s." % sys.version.split()[0])
|
||||
sys.exit(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
setup(name='pirate-get',
|
||||
version='0.2.8',
|
||||
description='A command line interface for The Pirate Bay',
|
||||
url='https://github.com/vikstrous/pirate-get',
|
||||
author='vikstrous',
|
||||
author_email='me@viktorstanchev.com',
|
||||
license='AGPL',
|
||||
packages=find_packages(),
|
||||
package_data={'': ["data/*.json"]},
|
||||
entry_points={
|
||||
'console_scripts': ['pirate-get = pirate.pirate:main']
|
||||
},
|
||||
install_requires=['colorama>=0.3.3',
|
||||
'beautifulsoup4>=4.4.1',
|
||||
'veryprettytable>=0.8.1'],
|
||||
keywords=['torrent', 'magnet', 'download', 'tpb', 'client'],
|
||||
classifiers=[
|
||||
'Topic :: Utilities',
|
||||
'Topic :: Terminals',
|
||||
'Topic :: System :: Networking',
|
||||
'Programming Language :: Python :: 3 :: Only',
|
||||
'Programming Language :: Python :: 3.4',
|
||||
'License :: OSI Approved :: GNU General Public License (GPL)',
|
||||
],
|
||||
test_suite='tests')
|
||||
|
@ -1,37 +1,40 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import os.path
|
||||
import unittest
|
||||
import importlib
|
||||
from unittest import mock
|
||||
from unittest.mock import patch, call, MagicMock
|
||||
|
||||
import pirate.pirate
|
||||
sys.path.append(os.path.join(os.path.dirname(__file__), '..'))
|
||||
|
||||
import setup
|
||||
|
||||
class TestPirate(unittest.TestCase):
|
||||
|
||||
@patch('sys.exit')
|
||||
def test_unsupported(self, mock_exit):
|
||||
sys.version = '3.2.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||
importlib.reload(pirate.pirate)
|
||||
importlib.reload(setup)
|
||||
mock_exit.assert_called_once_with(1)
|
||||
|
||||
@patch('sys.exit')
|
||||
def test_unsupported2(self, mock_exit):
|
||||
sys.version = '2.5.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||
importlib.reload(pirate.pirate)
|
||||
importlib.reload(setup)
|
||||
mock_exit.assert_called_once_with(1)
|
||||
|
||||
|
||||
@patch('sys.exit')
|
||||
def test_supported(self, mock_exit):
|
||||
sys.version = '3.5.1 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||
importlib.reload(pirate.pirate)
|
||||
importlib.reload(setup)
|
||||
mock_exit.assert_not_called()
|
||||
|
||||
@patch('sys.exit')
|
||||
def test_supported_exact(self, mock_exit):
|
||||
sys.version = '3.4.0 (default, dec 7 2015, 12:58:09) \n[gcc 5.2.0]'
|
||||
importlib.reload(pirate.pirate)
|
||||
importlib.reload(setup)
|
||||
mock_exit.assert_not_called()
|
||||
|
||||
if __name__ == '__main__':
|
||||
|
Loading…
Reference in New Issue
Block a user