Skip to content

Commit

Permalink
Merge pull request #11113 from swagger-api/codegen-generators-issues-917
Browse files Browse the repository at this point in the history
fixed python namespace package folders
  • Loading branch information
HugoMario authored Jul 31, 2021
2 parents e89c34f + 3620d45 commit b1b2bfe
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -204,16 +204,18 @@ public void processOpts() {

this.setCaseType();

final String packageFolder = packageName.replace('.', File.separatorChar);

supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));

supportingFiles.add(new SupportingFile("tox.mustache", "", "tox.ini"));
supportingFiles.add(new SupportingFile("test-requirements.mustache", "", "test-requirements.txt"));
supportingFiles.add(new SupportingFile("requirements.mustache", "", "requirements.txt"));

supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.py"));
supportingFiles.add(new SupportingFile("__init__package.mustache", packageName, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__model.mustache", packageName + File.separatorChar + modelPackage, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__api.mustache", packageName + File.separatorChar + apiPackage, "__init__.py"));
supportingFiles.add(new SupportingFile("configuration.mustache", packageFolder, "configuration.py"));
supportingFiles.add(new SupportingFile("__init__package.mustache", packageFolder, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__model.mustache", packageFolder + File.separatorChar + modelPackage, "__init__.py"));
supportingFiles.add(new SupportingFile("__init__api.mustache", packageFolder + File.separatorChar + apiPackage, "__init__.py"));

if(Boolean.FALSE.equals(excludeTests)) {
supportingFiles.add(new SupportingFile("__init__test.mustache", testFolder, "__init__.py"));
Expand All @@ -222,16 +224,16 @@ public void processOpts() {
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py"));
supportingFiles.add(new SupportingFile("api_client.mustache", packageName, "api_client.py"));
supportingFiles.add(new SupportingFile("api_client.mustache", packageFolder, "api_client.py"));

if ("asyncio".equals(getLibrary())) {
supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packageName, "rest.py"));
supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packageFolder, "rest.py"));
additionalProperties.put("asyncio", "true");
} else if ("tornado".equals(getLibrary())) {
supportingFiles.add(new SupportingFile("tornado/rest.mustache", packageName, "rest.py"));
supportingFiles.add(new SupportingFile("tornado/rest.mustache", packageFolder, "rest.py"));
additionalProperties.put("tornado", "true");
} else {
supportingFiles.add(new SupportingFile("rest.mustache", packageName, "rest.py"));
supportingFiles.add(new SupportingFile("rest.mustache", packageFolder, "rest.py"));
}

modelPackage = packageName + "." + modelPackage;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@ protected CodegenConfig getCodegenConfig() {
@Override
protected void setExpectations() {
new Expectations(clientCodegen) {{
clientCodegen.setPackageName(PythonClientOptionsProvider.PACKAGE_NAME_VALUE);
clientCodegen.setProjectName(PythonClientOptionsProvider.PROJECT_NAME_VALUE);
clientCodegen.setPackageVersion(PythonClientOptionsProvider.PACKAGE_VERSION_VALUE);
clientCodegen.setPackageUrl(PythonClientOptionsProvider.PACKAGE_URL_VALUE);
Expand Down

0 comments on commit b1b2bfe

Please sign in to comment.