diff options
author | Alex Grönholm <alex.gronholm@nextday.fi> | 2017-10-21 14:34:22 +0300 |
---|---|---|
committer | Alex Grönholm <alex.gronholm@nextday.fi> | 2017-10-21 14:34:22 +0300 |
commit | 6e2e380854901cca22d69dea258299d9d1d897b0 (patch) | |
tree | daab11fe1a3574b96b08b396748e78f0e027909d | |
parent | 73d4050c7e20c04be1ecef606512609445c3e0d0 (diff) | |
download | apscheduler-6e2e380854901cca22d69dea258299d9d1d897b0.tar.gz |
Added a workaround for import troubles with PyInstaller et al
-rw-r--r-- | apscheduler/__init__.py | 10 | ||||
-rw-r--r-- | docs/versionhistory.rst | 2 |
2 files changed, 10 insertions, 2 deletions
diff --git a/apscheduler/__init__.py b/apscheduler/__init__.py index cda59d4..7bf2c15 100644 --- a/apscheduler/__init__.py +++ b/apscheduler/__init__.py @@ -1,4 +1,10 @@ -# These will be removed in APScheduler 4.0. -release = __import__('pkg_resources').get_distribution('APScheduler').version.split('-')[0] +from pkg_resources import get_distribution, DistributionNotFound + +try: + release = get_distribution('APScheduler').version.split('-')[0] +except DistributionNotFound: + release = '3.4.0' + version_info = tuple(int(x) if x.isdigit() else x for x in release.split('.')) version = __version__ = '.'.join(str(x) for x in version_info[:3]) +del get_distribution, DistributionNotFound diff --git a/docs/versionhistory.rst b/docs/versionhistory.rst index 198ee74..34da4c0 100644 --- a/docs/versionhistory.rst +++ b/docs/versionhistory.rst @@ -10,6 +10,8 @@ APScheduler, see the :doc:`migration section <migration>`. * Dropped support for Python 3.3 * Added the ability to specify the table schema for ``SQLAlchemyJobStore`` (thanks to Meir Tseitlin) +* Added a workaround for the ``ImportError`` when used with PyInstaller and the likes + (caused by the missing packaging metadata when APScheduler is packaged with these tools) 3.3.1 |