def _add_json_data_files(self): local_pyrustic_data_folder = os.path.join(self._target, self._app_pkg, "pyrustic_data") resource_prefix = "manager/default_json/pyrustic_data/" # add dev.json path = os.path.join(local_pyrustic_data_folder, "dev.json") default_resource = resource_prefix + "dev_default.json" data = pkgutil.get_data("pyrustic", default_resource) if not os.path.exists(path): with open(path, "wb") as file: file.write(data) jasonix = Jasonix(path) jasonix.data["hooking_pkg"] = "{}.hooking".format(self._app_pkg) jasonix.save() # add gui.json path = os.path.join(local_pyrustic_data_folder, "gui.json") default_resource = resource_prefix + "gui_default.json" data = pkgutil.get_data("pyrustic", default_resource) if not os.path.exists(path): with open(path, "wb") as file: file.write(data) # add publishing.json path = os.path.join(local_pyrustic_data_folder, "publishing.json") default_resource = resource_prefix + "publishing_default.json" data = pkgutil.get_data("pyrustic", default_resource) if not os.path.exists(path): with open(path, "wb") as file: file.write(data) # add hubstore.json path = os.path.join(local_pyrustic_data_folder, "hubstore.json") default_resource = resource_prefix + "hubstore_default.json" data = pkgutil.get_data("pyrustic", default_resource) if not os.path.exists(path): with open(path, "wb") as file: file.write(data)
def edit_build_version(app_dir): about_json_path = os.path.join(app_dir, "pyrustic_data", "app.json") if not os.path.exists(about_json_path): return jasonix = Jasonix(about_json_path) current_version = jasonix.data.get("version", "0.0.1") message = "The current version is {}".format(current_version) print(message) message = "Set a new version or ignore: " new_version = input(message) if not new_version: return jasonix.data["version"] = new_version jasonix.save()
def _gen_build_report(self): pyrustic_data_path = os.path.join(self._target, self._app_pkg, "pyrustic_data") try: os.mkdir(pyrustic_data_path) except Exception as e: pass res = "manager/default_json/pyrustic_data/build_report_default.json" default_build_report_json = pkgutil.get_data("pyrustic", res) build_report_json = os.path.join(pyrustic_data_path, "build_report.json") jasonix = Jasonix(build_report_json, default=default_build_report_json) jasonix.data["timestamp"] = int(time.time()) jasonix.data["target"] = self._target jasonix.data["app_pkg"] = self._app_pkg wheels_assets_list = wheels_assets(self._target) wheel_asset = None if wheels_assets_list: wheel_asset = wheels_assets_list[0] wheel_asset = os.path.join(self._target, "dist", wheel_asset) jasonix.data["app_version"] = self._version jasonix.data["wheel_asset"] = wheel_asset jasonix.save()