Fix datadir creation for good
This commit is contained in:
parent
c91830d860
commit
b3f0088e64
|
@ -1,3 +1,7 @@
|
||||||
|
0.2.5:
|
||||||
|
- Python distutils/setuptools is a mess. Fix data dir creation on
|
||||||
|
install.
|
||||||
|
|
||||||
0.2.4:
|
0.2.4:
|
||||||
- Fixed built-in datadir creation again.
|
- Fixed built-in datadir creation again.
|
||||||
|
|
||||||
|
|
56
setup.py
56
setup.py
|
@ -4,6 +4,7 @@ from subprocess import check_call
|
||||||
from tempfile import mkdtemp
|
from tempfile import mkdtemp
|
||||||
|
|
||||||
from setuptools import find_packages, setup
|
from setuptools import find_packages, setup
|
||||||
|
from setuptools.command.build_py import build_py
|
||||||
from setuptools.command.develop import develop
|
from setuptools.command.develop import develop
|
||||||
from setuptools.command.install import install
|
from setuptools.command.install import install
|
||||||
from setuptools.command.sdist import sdist
|
from setuptools.command.sdist import sdist
|
||||||
|
@ -19,23 +20,28 @@ with open(Path(__file__).parent.joinpath('README.rst')) as fd:
|
||||||
_LONG_DESC = fd.read()
|
_LONG_DESC = fd.read()
|
||||||
|
|
||||||
|
|
||||||
|
def run_initial_updater():
|
||||||
|
'Download an initial blacklist.txt on install time.'
|
||||||
|
# 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.
|
||||||
|
_IS_VALIDATEEMAIL_SETUP = True
|
||||||
|
from validate_email.updater import BlacklistUpdater, LIB_PATH_DEFAULT
|
||||||
|
LIB_PATH_DEFAULT.mkdir(exist_ok=True)
|
||||||
|
blacklist_updater = BlacklistUpdater()
|
||||||
|
blacklist_updater._is_install_time = _IS_VALIDATEEMAIL_SETUP
|
||||||
|
blacklist_updater.process(force=True)
|
||||||
|
|
||||||
|
|
||||||
class InstallCommand(install):
|
class InstallCommand(install):
|
||||||
'Install command.'
|
'Install command.'
|
||||||
|
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
return super().run()
|
return super().run()
|
||||||
# Install dependencies so the initial update can run
|
run_initial_updater()
|
||||||
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.
|
|
||||||
_IS_VALIDATEEMAIL_SETUP = True
|
|
||||||
from validate_email.updater import BlacklistUpdater, LIB_PATH_DEFAULT
|
|
||||||
LIB_PATH_DEFAULT.mkdir(exist_ok=True)
|
|
||||||
blacklist_updater = BlacklistUpdater()
|
|
||||||
blacklist_updater._is_install_time = _IS_VALIDATEEMAIL_SETUP
|
|
||||||
blacklist_updater.process(force=True)
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
@ -45,17 +51,7 @@ class DevelopCommand(develop):
|
||||||
def run(self):
|
def run(self):
|
||||||
if self.dry_run:
|
if self.dry_run:
|
||||||
return super().run()
|
return super().run()
|
||||||
# Install dependencies so the initial update can run
|
run_initial_updater()
|
||||||
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.
|
|
||||||
_IS_VALIDATEEMAIL_SETUP = True
|
|
||||||
from validate_email.updater import BlacklistUpdater, LIB_PATH_DEFAULT
|
|
||||||
LIB_PATH_DEFAULT.mkdir(exist_ok=True)
|
|
||||||
blacklist_updater = BlacklistUpdater()
|
|
||||||
blacklist_updater._is_install_time = _IS_VALIDATEEMAIL_SETUP
|
|
||||||
blacklist_updater.process(force=True)
|
|
||||||
super().run()
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
|
@ -84,13 +80,24 @@ class SdistCommand(sdist):
|
||||||
rmtree(path=tempdir.parent)
|
rmtree(path=tempdir.parent)
|
||||||
|
|
||||||
|
|
||||||
|
class BuildPyCommand(build_py):
|
||||||
|
'BuildPy command.'
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if self.dry_run:
|
||||||
|
return super().run()
|
||||||
|
run_initial_updater()
|
||||||
|
super().run()
|
||||||
|
|
||||||
|
|
||||||
setup(
|
setup(
|
||||||
name='py3-validate-email',
|
name='py3-validate-email',
|
||||||
version='0.2.4',
|
version='0.2.5',
|
||||||
packages=find_packages(exclude=['tests']),
|
packages=find_packages(exclude=['tests']),
|
||||||
install_requires=_DEPENDENCIES,
|
install_requires=_DEPENDENCIES,
|
||||||
author='László Károlyi',
|
author='László Károlyi',
|
||||||
author_email='laszlo@karolyi.hu',
|
author_email='laszlo@karolyi.hu',
|
||||||
|
include_package_data=True,
|
||||||
description=(
|
description=(
|
||||||
'Email validator with regex, blacklisted domains and SMTP checking.'),
|
'Email validator with regex, blacklisted domains and SMTP checking.'),
|
||||||
long_description=_LONG_DESC,
|
long_description=_LONG_DESC,
|
||||||
|
@ -98,6 +105,7 @@ setup(
|
||||||
keywords='email validation verification mx verify',
|
keywords='email validation verification mx verify',
|
||||||
url='http://github.com/karolyi/py3-validate-email',
|
url='http://github.com/karolyi/py3-validate-email',
|
||||||
cmdclass=dict(
|
cmdclass=dict(
|
||||||
develop=DevelopCommand, install=InstallCommand, sdist=SdistCommand),
|
develop=DevelopCommand, sdist=SdistCommand,
|
||||||
|
build_py=BuildPyCommand),
|
||||||
license='LGPL',
|
license='LGPL',
|
||||||
)
|
)
|
||||||
|
|
Loading…
Reference in New Issue