File: hook-b2.py

package info (click to toggle)
backblaze-b2 3.19.1-4
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid
  • size: 1,372 kB
  • sloc: python: 12,571; makefile: 21; sh: 12
file content (33 lines) | stat: -rw-r--r-- 1,234 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
######################################################################
#
# File: pyinstaller-hooks/hook-b2.py
#
# Copyright 2022 Backblaze Inc. All Rights Reserved.
#
# License https://www.backblaze.com/using_b2_code.html
#
######################################################################

from pathlib import Path

license_file = Path('b2/licenses_output.txt')
assert license_file.exists()
datas = [
    # When '.' was provided here, the license file was copied to the root of the executable.
    # Before ApiVer, it pasted the file to the `b2/` directory.
    # I have no idea why it worked before or how it works now.
    # If you mean to debug it in the future, know that `pyinstaller` provides a special
    # attribute in the `sys` module whenever it runs.
    #
    # Example:
    #     import sys
    #     if hasattr(sys, '_MEIPASS'):
    #         self._print(f'{NAME}')
    #         self._print(f'{sys._MEIPASS}')
    #         elems = [elem for elem in pathlib.Path(sys._MEIPASS).glob('**/*')]
    #         self._print(f'{elems}')
    #
    # If used at the very start of the `_run` of `Licenses` command, it will print
    # all the files that were unpacked from the executable.
    (str(license_file), 'b2/'),
]