From e1bcdb92e7c0ec2540b6ddc0203f053dd914a37d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?L=C3=A1szl=C3=B3=20K=C3=A1rolyi?= Date: Sat, 11 Apr 2020 23:32:02 +0200 Subject: [PATCH] Fix installation + travis --- setup.py | 21 +++++++++++++++++++-- validate_email/updater.py | 1 + 2 files changed, 20 insertions(+), 2 deletions(-) diff --git a/setup.py b/setup.py index 27c4dd3..3bdbe96 100644 --- a/setup.py +++ b/setup.py @@ -1,7 +1,20 @@ +from pathlib import Path +from subprocess import check_call + from setuptools import find_packages, setup from setuptools.command.develop import develop from setuptools.command.install import install +try: + # OSX Homebrew fix + from sys import _base_executable as executable +except ImportError: + from sys import executable + +_DEPENDENCIES = ['dnspython>=1.16.0', 'idna>=2.8', 'filelock>=3.0.12'] +with open(Path(__file__).parent.joinpath('README.rst')) as fd: + _LONG_DESC = fd.read() + class PostInstallCommand(install): 'Post-installation command.' @@ -9,6 +22,8 @@ class PostInstallCommand(install): def run(self): if self.dry_run: return super().run() + # Install dependencies so the initial update can run + check_call([executable, '-m', 'pip', 'install'] + _DEPENDENCIES) # The updater will walk code stack frames and see if this # variable is set in locals() to determine if it is run from the # setup, in which case it won't autoupdate. @@ -26,6 +41,8 @@ class PostDevelopCommand(develop): def run(self): if self.dry_run: return super().run() + # Install dependencies so the initial update can run + check_call([executable, '-m', 'pip', 'install'] + _DEPENDENCIES) # The updater will walk code stack frames and see if this # variable is set in locals() to determine if it is run from the # setup, in which case it won't autoupdate. @@ -41,12 +58,12 @@ setup( name='py3-validate-email', version='0.2.1', packages=find_packages(exclude=['tests']), - install_requires=['dnspython>=1.16.0', 'idna>=2.8', 'filelock>=3.0.12'], + install_requires=_DEPENDENCIES, author='László Károlyi', author_email='laszlo@karolyi.hu', description=( 'Email validator with regex, blacklisted domains and SMTP checking.'), - long_description=open('README.rst').read(), + long_description=_LONG_DESC, long_description_content_type='text/x-rst', keywords='email validation verification mx verify', url='http://github.com/karolyi/py3-validate-email', diff --git a/validate_email/updater.py b/validate_email/updater.py index 7fd79df..3aa89bd 100644 --- a/validate_email/updater.py +++ b/validate_email/updater.py @@ -19,6 +19,7 @@ BLACKLIST_URL = ( 'https://raw.githubusercontent.com/martenson/disposable-email-domains/' 'master/disposable_email_blocklist.conf') LIB_PATH_DEFAULT = Path(__file__).resolve().parent.joinpath('data') +LIB_PATH_DEFAULT.mkdir(exist_ok=True) BLACKLIST_FILEPATH_INSTALLED = LIB_PATH_DEFAULT.joinpath('blacklist.txt') BLACKLIST_FILEPATH_TMP = TMP_PATH.joinpath('blacklist.txt') ETAG_FILEPATH_INSTALLED = LIB_PATH_DEFAULT.joinpath('blacklist.etag.txt')