Fix installation + travis

This commit is contained in:
László Károlyi 2020-04-11 23:32:02 +02:00
parent 6790ded356
commit e1bcdb92e7
Signed by: karolyi
GPG Key ID: 2DCAF25E55735BFE
2 changed files with 20 additions and 2 deletions

View File

@ -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',

View File

@ -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')