electrum

Electrum Bitcoin wallet
git clone https://git.parazyd.org/electrum
Log | Files | Refs | Submodules

commit 071bc27016125f214be0f433c3a0cb2ed73ed0d6
parent 12e79ecd6075e81c69f545066c8b5b1d9057a003
Author: SomberNight <somber.night@protonmail.com>
Date:   Fri, 28 Sep 2018 02:47:36 +0200

setup.py: rm deprecated 'imp'. dedupe min py version

Diffstat:
Msetup.py | 19+++++++++++++------
1 file changed, 13 insertions(+), 6 deletions(-)

diff --git a/setup.py b/setup.py @@ -5,23 +5,30 @@ import os import sys import platform -import imp +import importlib.util import argparse import subprocess from setuptools import setup, find_packages from setuptools.command.install import install +MIN_PYTHON_VERSION = "3.6" +_min_python_version_tuple = tuple(map(int, (MIN_PYTHON_VERSION.split(".")))) + + +if sys.version_info[:3] < _min_python_version_tuple: + sys.exit("Error: Electrum requires Python version >= {}...".format(MIN_PYTHON_VERSION)) + with open('contrib/requirements/requirements.txt') as f: requirements = f.read().splitlines() with open('contrib/requirements/requirements-hw.txt') as f: requirements_hw = f.read().splitlines() -version = imp.load_source('version', 'electrum/version.py') - -if sys.version_info[:3] < (3, 6, 0): - sys.exit("Error: Electrum requires Python version >= 3.6.0...") +# load version.py; needlessly complicated alternative to "imp.load_source": +version_spec = importlib.util.spec_from_file_location('version', 'electrum/version.py') +version_module = version = importlib.util.module_from_spec(version_spec) +version_spec.loader.exec_module(version_module) data_files = [] @@ -71,7 +78,7 @@ class CustomInstallCommand(install): setup( name="Electrum", version=version.ELECTRUM_VERSION, - python_requires='>=3.6', + python_requires='>={}'.format(MIN_PYTHON_VERSION), install_requires=requirements, extras_require=extras_require, packages=[