py3-validate-email/setup.py

42 lines
1.3 KiB
Python
Raw Normal View History

2019-03-02 02:17:12 +01:00
from os.path import join
from urllib.request import urlopen
2019-03-02 00:59:23 +01:00
2019-03-02 02:17:12 +01:00
from setuptools import find_packages, setup
from setuptools.command.build_py import build_py
2019-03-02 00:59:23 +01:00
2019-11-21 15:41:05 +01:00
BLACKLIST_URL = (
2019-03-02 02:17:12 +01:00
'https://raw.githubusercontent.com/martenson/disposable-email-domains/'
'master/disposable_email_blocklist.conf')
2019-03-02 00:59:23 +01:00
2019-03-02 02:17:12 +01:00
class PostBuildPyCommand(build_py):
'Post-installation for build_py'
2019-03-02 00:59:23 +01:00
def run(self):
2019-03-02 02:17:12 +01:00
if self.dry_run:
return super().run()
2019-11-21 15:41:05 +01:00
with urlopen(url=BLACKLIST_URL) as fd:
2019-03-02 02:17:12 +01:00
content = fd.read().decode('utf-8')
target_dir = join(self.build_lib, 'validate_email/lib')
2019-11-21 15:41:05 +01:00
self.mkpath(name=target_dir)
2019-03-02 02:17:12 +01:00
with open(join(target_dir, 'blacklist.txt'), 'w') as fd:
fd.write(content)
2019-03-02 00:59:23 +01:00
super().run()
2012-04-07 23:05:57 +02:00
2018-05-31 13:13:28 +02:00
setup(
2019-03-01 23:29:01 +01:00
name='py3-validate-email',
2019-11-21 15:41:05 +01:00
version='0.1.12',
2019-03-02 02:17:12 +01:00
packages=find_packages(exclude=['tests']),
install_requires=['dnspython>=1.16.0', 'idna>=2.8'],
2019-03-01 23:29:01 +01:00
author='László Károlyi',
2019-03-01 20:37:52 +01:00
author_email='laszlo@karolyi.hu',
2019-03-01 23:29:01 +01:00
description='Email validator with regex and SMTP checking.',
2019-03-01 20:37:52 +01:00
long_description=open('README.rst').read(),
2019-03-02 03:26:58 +01:00
long_description_content_type='text/x-rst',
2019-03-01 20:37:52 +01:00
keywords='email validation verification mx verify',
2019-03-01 23:29:01 +01:00
url='http://github.com/karolyi/py3-validate-email',
2019-03-02 02:17:12 +01:00
cmdclass=dict(build_py=PostBuildPyCommand),
2019-03-01 20:37:52 +01:00
license='LGPL',
2018-05-31 13:13:28 +02:00
)