Last active
August 1, 2018 18:31
-
-
Save lmazuel/5f9bb30674ce9c7f7cd57979aa813131 to your computer and use it in GitHub Desktop.
Readme helper super stupid and simple (own usage only, no can find this interesting...)
This file contains hidden or 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
packages = [ | |
'azure-mgmt-advisor~=1.0', | |
'azure-mgmt-applicationinsights~=0.1.1', | |
'azure-mgmt-authorization~=0.50.0', | |
'azure-mgmt-batch~=5.0', | |
'azure-mgmt-batchai~=2.0', | |
'azure-mgmt-billing~=0.2.0', | |
'azure-mgmt-botservice~=0.1.0', | |
'azure-mgmt-cdn~=3.0', | |
'azure-mgmt-cognitiveservices~=3.0', | |
'azure-mgmt-commerce~=1.0', | |
'azure-mgmt-compute~=4.0', | |
'azure-mgmt-consumption~=2.0', | |
'azure-mgmt-containerinstance~=1.0', | |
'azure-mgmt-containerregistry~=2.1', | |
'azure-mgmt-containerservice~=4.2', | |
'azure-mgmt-cosmosdb~=0.4.1', | |
'azure-mgmt-datafactory~=0.6.0', | |
'azure-mgmt-datalake-analytics~=0.6.0', | |
'azure-mgmt-datalake-store~=0.5.0', | |
'azure-mgmt-datamigration~=1.0', | |
'azure-mgmt-devspaces~=0.1.0', | |
'azure-mgmt-devtestlabs~=2.2', | |
'azure-mgmt-dns~=1.2', | |
'azure-mgmt-eventgrid~=1.0', | |
'azure-mgmt-eventhub~=2.1', | |
'azure-mgmt-hanaonazure~=0.1.1', | |
'azure-mgmt-iotcentral~=0.1.0', | |
'azure-mgmt-iothub~=0.5.0', | |
'azure-mgmt-iothubprovisioningservices~=0.2.0', | |
'azure-mgmt-keyvault~=1.1', | |
'azure-mgmt-loganalytics~=0.2.0', | |
'azure-mgmt-logic~=3.0', | |
'azure-mgmt-machinelearningcompute~=0.4.1', | |
'azure-mgmt-managementgroups~=0.1.0', | |
'azure-mgmt-managementpartner~=0.1.0', | |
'azure-mgmt-maps~=0.1.0', | |
'azure-mgmt-marketplaceordering~=0.1.0', | |
'azure-mgmt-media~=0.2.0', | |
'azure-mgmt-monitor~=0.5.2', | |
'azure-mgmt-msi~=0.2.0', | |
'azure-mgmt-network~=2.0', | |
'azure-mgmt-notificationhubs~=2.0', | |
'azure-mgmt-policyinsights~=0.1.0', | |
'azure-mgmt-powerbiembedded~=2.0', | |
'azure-mgmt-rdbms~=1.2', | |
'azure-mgmt-recoveryservices~=0.3.0', | |
'azure-mgmt-recoveryservicesbackup~=0.3.0', | |
'azure-mgmt-redis~=5.0', | |
'azure-mgmt-relay~=0.1.0', | |
'azure-mgmt-reservations~=0.2.1', | |
'azure-mgmt-resource~=2.0', | |
'azure-mgmt-scheduler~=2.0', | |
'azure-mgmt-search~=2.0', | |
'azure-mgmt-servicebus~=0.5.1', | |
'azure-mgmt-servicefabric~=0.1.0', | |
'azure-mgmt-signalr~=0.1.0', | |
'azure-mgmt-sql~=0.9.1', | |
'azure-mgmt-storage~=2.0', | |
'azure-mgmt-subscription~=0.2.0', | |
'azure-mgmt-trafficmanager~=0.50.0', | |
'azure-mgmt-web~=0.35.0', | |
] | |
for package in packages: | |
package, version = package.split("~=") | |
version = version.rstrip("0123456789") + "x" | |
print("- `{package} v{version} <https://pypi.python.org/pypi/{package}>`__".format( | |
package=package, | |
version=version | |
)) |
This file contains hidden or 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
import os.path | |
import re | |
from pathlib import Path | |
from packaging.version import parse as Version, InvalidVersion | |
root = Path() | |
package_list = [p.as_posix() for p in root.iterdir()] | |
filtered_package_list = [p for p in package_list if p.startswith("azure-mgmt-") and not p.endswith("nspkg")] | |
def extract_version(package_name): | |
package_folder_path = [package_name]+package_name.split('-') + ['version.py'] | |
with open(os.path.join(*package_folder_path), 'r') as fd: | |
return re.search(r'^VERSION\s*=\s*[\'"]([^\'"]*)[\'"]', | |
fd.read(), re.MULTILINE).group(1) | |
exceptions={ | |
"azure-mgmt-dns":Version("1.2.0"), | |
"azure-mgmt-eventgrid":Version("1.0.0"), | |
"azure-mgmt-media":Version("0.2.0"), | |
} | |
def build_dep(version, p): | |
parsed_version = Version(version) | |
if (parsed_version.is_prerelease or parsed_version.is_postrelease) and not p in exceptions: | |
raise ValueError("Not bundle should be released with a RC or alpha release: {}".format(p)) | |
if p in exceptions: | |
parsed_version = exceptions[p] | |
split_version = parsed_version.base_version.split(".") | |
if split_version[0] == "0": | |
return "~=0.{}.{}".format(split_version[1], split_version[2]) | |
return "~={}.{}".format(split_version[0], split_version[1]) | |
for p in filtered_package_list: | |
version = extract_version(p) | |
dep = build_dep(version, p) | |
print("'{}{}',".format(p, dep)) | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment