Skip to content

Commit fede87c

Browse files
committed
feat(build): add bw2io hook
1 parent 7860659 commit fede87c

File tree

5 files changed

+44
-2
lines changed

5 files changed

+44
-2
lines changed

README.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -235,3 +235,12 @@ If you experience problems or are suffering from a specific bug, please [raise a
235235

236236
# License
237237
You can find the license information for Activity Browser in the [license file](https://github.com/LCA-ActivityBrowser/activity-browser/blob/main/LICENSE.txt).
238+
239+
240+
# Build
241+
242+
```bash
243+
pip install third-party-license-file-generator
244+
pip freeze > requirements.txt
245+
python -m third_party_license_file_generator -r requirements.txt -p .venv/bin/python -c -g
246+
```

activity-browser.spec

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ a = Analysis(
2323
binaries=[],
2424
datas=[],
2525
hiddenimports=["activity_browser"],
26-
hookspath=[],
26+
hookspath=['scripts/hooks'],
2727
hooksconfig={},
2828
runtime_hooks=[],
2929
excludes=[],

activity_browser/logger.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -209,7 +209,11 @@ def __init__(self):
209209
self.filename = "ab_logs" + self.timestamp() + ".csv"
210210

211211
# set dir and create it if it doesn't exist yet
212-
dir_path = str(platformdirs.user_log_dir(appname="ActivityBrowser", appauthor="ActivityBrowser"))
212+
dir_path = str(
213+
platformdirs.user_log_dir(
214+
appname="ActivityBrowser", appauthor="ActivityBrowser"
215+
)
216+
)
213217
os.makedirs(dir_path, exist_ok=True)
214218

215219
# create final filepath of the logfile of this session

scripts/createmsi.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def __init__(self, signing_certificate=None, version=None):
8686
"C:\\Program Files (x86)\\Microsoft Visual Studio\\2019\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC142_CRT_x64.msm",
8787
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Redist\\MSVC\\v*\\MergeModules\\Microsoft_VC143_CRT_x64.msm",
8888
"C:\\Program Files\\Microsoft Visual Studio\\2022\\Community\\VC\\Redist\\MSVC\\*\\MergeModules\\Microsoft_VC143_CRT_x64.msm",
89+
r"C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Redist\MSVC\v*\MergeModules\Microsoft_VC143_CRT_x64.msm",
8990
]
9091
redist_path = None
9192
for g in redist_globs:

scripts/hooks/hook-bw2io.py

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
import os
2+
3+
from PyInstaller.utils.hooks import get_package_paths
4+
from PyInstaller import log as logging
5+
6+
BW2IO_DIR = get_package_paths("bw2io")[1]
7+
8+
logger = logging.getLogger(__name__)
9+
10+
# Info
11+
logger.info("bw2io python package directory: %s" % BW2IO_DIR)
12+
13+
# Hidden imports.
14+
hiddenimports = []
15+
# Excluded modules
16+
excludedimports = []
17+
18+
# Include binaries
19+
binaries = []
20+
21+
# Include datas
22+
datas = [
23+
(os.path.join(BW2IO_DIR, "data"), "./bw2io/data"),
24+
]
25+
26+
# Notify pyinstaller.spec code that this hook was executed
27+
# and that it succeeded.
28+
os.environ["PYINSTALLER_BW2IO_HOOK_SUCCEEDED"] = "1"

0 commit comments

Comments
 (0)