-
Notifications
You must be signed in to change notification settings - Fork 11
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Allow stripping binaries when distribution of wheels is enabled * Added emoji component and PIL image to JUCE image * Added more juce_core bindings * Allow embedding the python standard library in a juce app * Improved hotreloading * More unit tests * Fix Justification class failures * Fix problems with KeyPress * Bump to JUCE 7.0.10 * Improved exception handling * Avoid memory leaks
- Loading branch information
Showing
61 changed files
with
3,648 additions
and
417 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
import os | ||
import stat | ||
import shutil | ||
import hashlib | ||
import zipfile | ||
from pathlib import Path | ||
from argparse import ArgumentParser | ||
|
||
|
||
def file_hash(file): | ||
h = hashlib.md5() | ||
|
||
with open(file, "rb") as f: | ||
h.update(f.read()) | ||
|
||
return h.hexdigest() | ||
|
||
|
||
def make_archive(file, directory): | ||
archived_files = [] | ||
for dirname, _, files in os.walk(directory): | ||
for filename in files: | ||
path = os.path.join(dirname, filename) | ||
archived_files.append((path, os.path.relpath(path, directory))) | ||
|
||
with zipfile.ZipFile(file, "w") as zf: | ||
for path, archive_path in sorted(archived_files): | ||
permission = 0o555 if os.access(path, os.X_OK) else 0o444 | ||
|
||
zip_info = zipfile.ZipInfo.from_file(path, archive_path) | ||
zip_info.date_time = (1999, 1, 1, 0, 0, 0) | ||
zip_info.external_attr = (stat.S_IFREG | permission) << 16 | ||
|
||
with open(path, "rb") as fp: | ||
zf.writestr(zip_info, fp.read(), compress_type=zipfile.ZIP_DEFLATED, compresslevel=9) | ||
|
||
|
||
if __name__ == "__main__": | ||
parser = ArgumentParser() | ||
parser.add_argument("-b", "--base-folder", type=Path, help="Path to the base folder.") | ||
parser.add_argument("-o", "--output-folder", type=Path, help="Path to the output folder.") | ||
parser.add_argument("-M", "--version-major", type=int, help="Major version number (integer).") | ||
parser.add_argument("-m", "--version-minor", type=int, help="Minor version number (integer).") | ||
parser.add_argument("-i", "--ignore-patterns", type=str, default=None, help="Ignored patterns (semicolon separated list).") | ||
|
||
args = parser.parse_args() | ||
|
||
version = f"{args.version_major}.{args.version_minor}" | ||
version_nodot = f"{args.version_major}{args.version_minor}" | ||
|
||
final_location: Path = args.output_folder / "python" | ||
site_packages = final_location / "site-packages" | ||
base_python: Path = args.base_folder / "lib" / f"python{version}" | ||
final_archive = args.output_folder / f"python{version_nodot}.zip" | ||
temp_archive = args.output_folder / f"temp{version_nodot}.zip" | ||
|
||
base_patterns = [ | ||
"*.pyc", | ||
"__pycache__", | ||
"__phello__", | ||
"*config-3*", | ||
"*tcl*", | ||
"*tdbc*", | ||
"*tk*", | ||
"Tk*", | ||
"_tk*", | ||
"_test*", | ||
"libpython*", | ||
"pkgconfig", | ||
"idlelib", | ||
"site-packages", | ||
"test", | ||
"turtledemo", | ||
"LICENSE.txt", | ||
] | ||
|
||
if args.ignore_patterns: | ||
custom_patterns = [x.strip() for x in args.ignore_patterns.split(";")] | ||
base_patterns += custom_patterns | ||
|
||
ignored_files = shutil.ignore_patterns(*base_patterns) | ||
|
||
print("cleaning up...") | ||
if final_location.exists(): | ||
shutil.rmtree(final_location) | ||
|
||
print("copying library...") | ||
shutil.copytree(base_python, final_location, ignore=ignored_files, dirs_exist_ok=True) | ||
os.makedirs(site_packages, exist_ok=True) | ||
|
||
print("making archive...") | ||
if os.path.exists(final_archive): | ||
make_archive(temp_archive, final_location) | ||
if file_hash(temp_archive) != file_hash(final_archive): | ||
shutil.copy(temp_archive, final_archive) | ||
else: | ||
make_archive(final_archive, final_location) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.