From 1eeaa8caec01e71738813e7146e6e61ec941dd5b Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 28 Jan 2022 16:39:11 +0200 Subject: [PATCH 1/2] PyInstaller hook --- setup.py | 3 ++ src/timeago/__pyinstaller/__init__.py | 5 +++ src/timeago/__pyinstaller/hook-timeago.py | 48 +++++++++++++++++++++++ 3 files changed, 56 insertions(+) create mode 100644 src/timeago/__pyinstaller/__init__.py create mode 100644 src/timeago/__pyinstaller/hook-timeago.py diff --git a/setup.py b/setup.py index 71fbd02..19721e1 100644 --- a/setup.py +++ b/setup.py @@ -36,4 +36,7 @@ def readme(): keywords = 'timeago, seconds ago, minutes ago, hours ago, just now', packages = find_packages('src'), package_dir = {'':'src'}, + entry_points = { + 'pyinstaller40': ['hook-dirs = timeago.__pyinstaller:get_hook_dirs'] + } ) diff --git a/src/timeago/__pyinstaller/__init__.py b/src/timeago/__pyinstaller/__init__.py new file mode 100644 index 0000000..e05cf16 --- /dev/null +++ b/src/timeago/__pyinstaller/__init__.py @@ -0,0 +1,5 @@ +import os.path + + +def get_hook_dirs(): + return [os.path.dirname(__file__)] diff --git a/src/timeago/__pyinstaller/hook-timeago.py b/src/timeago/__pyinstaller/hook-timeago.py new file mode 100644 index 0000000..77dd6d9 --- /dev/null +++ b/src/timeago/__pyinstaller/hook-timeago.py @@ -0,0 +1,48 @@ +_locales = ( + 'ar', + 'bg', + 'ca', + 'da', + 'de', + 'el', + 'en_short', + 'en', + 'es', + 'eu', + 'fa_IR', + 'fi', + 'fr', + 'gl', + 'guj_IN', + 'he', + 'hu', + 'in_BG', + 'in_HI', + 'in_ID', + 'is', + 'it', + 'ja', + 'ko', + 'lt', + 'ml', + 'my', + 'nb_NO', + 'nl', + 'nn_NO', + 'pl', + 'pt_BR', + 'pt_PT', + 'ro', + 'ru', + 'sv_SE', + 'ta', + 'th', + 'tr', + 'uk', + 'vi', + 'zh_CN', + 'zh_TW' +) + + +hiddenimports = [f'timeago.locales.{locale}' for locale in _locales] From 9f7387d7f163f663969b7630852a04fef8173465 Mon Sep 17 00:00:00 2001 From: Alexander Date: Fri, 28 Jan 2022 16:47:27 +0200 Subject: [PATCH 2/2] Add headers --- src/timeago/__pyinstaller/__init__.py | 8 ++++++++ src/timeago/__pyinstaller/hook-timeago.py | 8 ++++++++ 2 files changed, 16 insertions(+) diff --git a/src/timeago/__pyinstaller/__init__.py b/src/timeago/__pyinstaller/__init__.py index e05cf16..a2d83c9 100644 --- a/src/timeago/__pyinstaller/__init__.py +++ b/src/timeago/__pyinstaller/__init__.py @@ -1,3 +1,11 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +''' +Created on 2022-01-28 + +@author: alexitx +''' + import os.path diff --git a/src/timeago/__pyinstaller/hook-timeago.py b/src/timeago/__pyinstaller/hook-timeago.py index 77dd6d9..5bc4f65 100644 --- a/src/timeago/__pyinstaller/hook-timeago.py +++ b/src/timeago/__pyinstaller/hook-timeago.py @@ -1,3 +1,11 @@ +#!/usr/bin/env python +# -*- coding: utf-8 -*- +''' +Created on 2022-01-28 + +@author: alexitx +''' + _locales = ( 'ar', 'bg',