From 89bf3509eae9a4ae7ca04d234e464681041b0467 Mon Sep 17 00:00:00 2001 From: Xing Wu Date: Fri, 17 Jun 2016 10:01:17 -0700 Subject: [PATCH] Reuse the global autorest parameter. (#1171) --- .../Python/Azure.Python/AzurePythonCodeGenerator.cs | 4 ++-- .../Generators/Python/Python/PythonCodeGenerator.cs | 13 +++++++++---- 2 files changed, 11 insertions(+), 6 deletions(-) diff --git a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs index 91a632f806330..1b83e942a0bc6 100644 --- a/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs +++ b/AutoRest/Generators/Python/Azure.Python/AzurePythonCodeGenerator.cs @@ -237,9 +237,9 @@ public override async Task Generate(ServiceClient serviceClient) { var serviceClientTemplateModel = new AzureServiceClientTemplateModel(serviceClient); - if (!string.IsNullOrWhiteSpace(Version)) + if (!string.IsNullOrWhiteSpace(this.PackageVersion)) { - serviceClientTemplateModel.Version = Version; + serviceClientTemplateModel.Version = this.PackageVersion; } // Service client diff --git a/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs b/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs index 0a050047a15da..0a50960f9b5b9 100644 --- a/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs +++ b/AutoRest/Generators/Python/Python/PythonCodeGenerator.cs @@ -19,9 +19,12 @@ public class PythonCodeGenerator : CodeGenerator { private const string ClientRuntimePackage = "msrest version 0.4.0"; + private string packageVersion; + public PythonCodeGenerator(Settings settings) : base(settings) { Namer = new PythonCodeNamer(); + this.packageVersion = Settings.PackageVersion; } public PythonCodeNamer Namer { get; set; } @@ -37,8 +40,10 @@ public override string Description get { return "Generic Python code generator."; } } - [SettingsInfo("The SDK version for generated setup.py.")] - public string Version { get; set; } + protected String PackageVersion + { + get { return this.packageVersion; } + } public override string UsageInstructions { @@ -94,9 +99,9 @@ public override async Task Generate(ServiceClient serviceClient) { var serviceClientTemplateModel = new ServiceClientTemplateModel(serviceClient); - if (!string.IsNullOrWhiteSpace(Version)) + if (!string.IsNullOrWhiteSpace(this.PackageVersion)) { - serviceClientTemplateModel.Version = Version; + serviceClientTemplateModel.Version = this.PackageVersion; } // Service client