Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
14 changes: 5 additions & 9 deletions tools/azure-sdk-tools/packaging_tools/package_utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,13 +170,6 @@ def next_version(self) -> str:
self._next_version = self.calculate_next_version()
return self._next_version

def get_private_package(self) -> List[str]:
return self.package_info["artifacts"]

@property
def get_whl_package(self) -> str:
return [package for package in self.get_private_package() if package.endswith(".whl")][0]

# Use the template to update readme and setup by packaging_tools
@return_origin_path
def check_file_with_packaging_tool(self):
Expand Down Expand Up @@ -369,5 +362,8 @@ def run(self):
self.check_pyproject_toml()


def check_file(package_info: Dict[str, Any]):
CheckFile(package_info).run()
def check_file(package: Dict[str, Any]):
client = CheckFile(package)
client.run()
if not client.has_invalid_next_version:
package["version"] = client.next_version
32 changes: 18 additions & 14 deletions tools/azure-sdk-tools/packaging_tools/sdk_package.py
Original file line number Diff line number Diff line change
Expand Up @@ -59,13 +59,8 @@ def main(generate_input, generate_output):
package["version"] = last_version

_LOGGER.info(f"[PACKAGE]({package_name})[CHANGELOG]:{md_output}")
# Built package
create_package(prefolder, package_name)
folder_name = package["path"][0]
dist_path = Path(sdk_folder, folder_name, package_name, "dist")
package["artifacts"] = [str(dist_path / package_file) for package_file in os.listdir(dist_path)]
package["result"] = "succeeded"
# Generate api stub File
folder_name = package["path"][0]
try:
package_path = Path(sdk_folder, folder_name, package_name)
check_call(
Expand All @@ -87,22 +82,31 @@ def main(generate_input, generate_output):
package["apiViewArtifact"] = str(Path(package_path, file))
except Exception as e:
_LOGGER.debug(f"Fail to generate ApiView token file for {package_name}: {e}")

# check generated files and update package["version"]
if package_name.startswith("azure-mgmt-"):
try:
check_file(package)
except Exception as e:
_LOGGER.error(f"Fail to check generated files for {package_name}: {e}")

# Built package
create_package(prefolder, package_name)
dist_path = Path(sdk_folder, folder_name, package_name, "dist")
package["artifacts"] = [str(dist_path / package_file) for package_file in os.listdir(dist_path)]
for artifact in package["artifacts"]:
if ".whl" in artifact:
package["language"] = "Python"
break
# Installation package
package["installInstructions"] = {
"full": "You can install the use using pip install of the artifacts.",
"lite": f"pip install {package_name}",
}
for artifact in package["artifacts"]:
if ".whl" in artifact:
package["language"] = "Python"
break
package["result"] = "succeeded"
package["packageFolder"] = package["path"][0]
result["packages"].append(package)

# check generated files
if package_name.startswith("azure-mgmt-"):
check_file(package)

with open(generate_output, "w") as writer:
json.dump(result, writer)

Expand Down
Loading