Skip to content

Commit

Permalink
Reuse the global autorest parameter. (Azure#1171)
Browse files Browse the repository at this point in the history
  • Loading branch information
xingwu1 authored and tbombach committed Jun 17, 2016
1 parent f1df2ab commit 89bf350
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
13 changes: 9 additions & 4 deletions AutoRest/Generators/Python/Python/PythonCodeGenerator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -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
{
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit 89bf350

Please sign in to comment.