Skip to content

Commit

Permalink
add version + formatter
Browse files Browse the repository at this point in the history
  • Loading branch information
Xavrax committed Sep 5, 2024
1 parent 06cd138 commit 98dc480
Showing 1 changed file with 25 additions and 14 deletions.
39 changes: 25 additions & 14 deletions make_packages.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,9 @@
def add_license(filename):
with open("LICENSE", "r") as license_file:
license_text = license_file.read()
license_text = ['// ' + line for line in license_text.split('\n')]
license_text = ["// " + line for line in license_text.split("\n")]
license_text.pop()
license_text = '\n'.join(license_text)
license_text = "\n".join(license_text)
file_text = ""
with open(filename, "r") as file:
file_text = file.read()
Expand All @@ -40,34 +40,45 @@ def add_license(filename):
shutil.rmtree(temporary_dir + "/readme_content", ignore_errors=True)

cpp_files = itertools.chain(
glob.glob(temporary_dir + '/**/*.cpp', recursive=True),
glob.glob(temporary_dir + '/**/*.hpp', recursive=True),
glob.glob(temporary_dir + '/**/*.c', recursive=True),
glob.glob(temporary_dir + '/**/*.h', recursive=True))
glob.glob(temporary_dir + "/**/*.cpp", recursive=True),
glob.glob(temporary_dir + "/**/*.hpp", recursive=True),
glob.glob(temporary_dir + "/**/*.c", recursive=True),
glob.glob(temporary_dir + "/**/*.h", recursive=True),
)

for version in supported_ue_versions:
with open(temporary_dir + "/PubnubLibrary.uplugin", "r") as uplugin_file:
uplugin = json.load(uplugin_file)
uplugin["EngineVersion"] = version
with open(temporary_dir + "/PubnubLibrary.uplugin",
"w") as uplugin_file_write:
plugin_version = uplugin["VersionName"]
with open(
temporary_dir + "/PubnubLibrary.uplugin", "w"
) as uplugin_file_write:
json.dump(uplugin, uplugin_file_write, indent=4)

for filename in cpp_files:
print(filename)
add_license(filename)

zipf = zipfile.ZipFile(
temporary_dir + "../Pubnub-" + version + ".zip", 'w',
zipfile.ZIP_DEFLATED)
temporary_dir
+ "../Pubnub-"
+ plugin_version
+ "-ue"
+ version
+ ".zip",
"w",
zipfile.ZIP_DEFLATED,
)

for root, dirs, inner_files in os.walk(temporary_dir):
for file in inner_files:
zipf.write(
os.path.join(root, file),
os.path.relpath(
os.path.join(root, file),
os.path.join(temporary_dir, '..')))
os.path.join(root, file),
os.path.relpath(
os.path.join(root, file), os.path.join(temporary_dir, "..")
),
)

zipf.close()

Expand Down

0 comments on commit 98dc480

Please sign in to comment.