Skip to content

Commit 1c00e7a

Browse files
committed
fix python namespace package folders
1 parent 60f61b8 commit 1c00e7a

File tree

1 file changed

+10
-8
lines changed

1 file changed

+10
-8
lines changed

src/main/java/io/swagger/codegen/v3/generators/python/PythonClientCodegen.java

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -201,16 +201,18 @@ public void processOpts() {
201201
setPackageUrl((String) additionalProperties.get(PACKAGE_URL));
202202
}
203203

204+
final String packageFolder = packageName.replace('.', File.separatorChar);
205+
204206
supportingFiles.add(new SupportingFile("README.mustache", "", "README.md"));
205207

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

210-
supportingFiles.add(new SupportingFile("configuration.mustache", packageName, "configuration.py"));
211-
supportingFiles.add(new SupportingFile("__init__package.mustache", packageName, "__init__.py"));
212-
supportingFiles.add(new SupportingFile("__init__model.mustache", packageName + File.separatorChar + modelPackage, "__init__.py"));
213-
supportingFiles.add(new SupportingFile("__init__api.mustache", packageName + File.separatorChar + apiPackage, "__init__.py"));
212+
supportingFiles.add(new SupportingFile("configuration.mustache", packageFolder, "configuration.py"));
213+
supportingFiles.add(new SupportingFile("__init__package.mustache", packageFolder, "__init__.py"));
214+
supportingFiles.add(new SupportingFile("__init__model.mustache", packageFolder + File.separatorChar + modelPackage, "__init__.py"));
215+
supportingFiles.add(new SupportingFile("__init__api.mustache", packageFolder + File.separatorChar + apiPackage, "__init__.py"));
214216

215217
if(Boolean.FALSE.equals(excludeTests)) {
216218
supportingFiles.add(new SupportingFile("__init__test.mustache", testFolder, "__init__.py"));
@@ -219,16 +221,16 @@ public void processOpts() {
219221
supportingFiles.add(new SupportingFile("gitignore.mustache", "", ".gitignore"));
220222
supportingFiles.add(new SupportingFile("travis.mustache", "", ".travis.yml"));
221223
supportingFiles.add(new SupportingFile("setup.mustache", "", "setup.py"));
222-
supportingFiles.add(new SupportingFile("api_client.mustache", packageName, "api_client.py"));
224+
supportingFiles.add(new SupportingFile("api_client.mustache", packageFolder, "api_client.py"));
223225

224226
if ("asyncio".equals(getLibrary())) {
225-
supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packageName, "rest.py"));
227+
supportingFiles.add(new SupportingFile("asyncio/rest.mustache", packageFolder, "rest.py"));
226228
additionalProperties.put("asyncio", "true");
227229
} else if ("tornado".equals(getLibrary())) {
228-
supportingFiles.add(new SupportingFile("tornado/rest.mustache", packageName, "rest.py"));
230+
supportingFiles.add(new SupportingFile("tornado/rest.mustache", packageFolder, "rest.py"));
229231
additionalProperties.put("tornado", "true");
230232
} else {
231-
supportingFiles.add(new SupportingFile("rest.mustache", packageName, "rest.py"));
233+
supportingFiles.add(new SupportingFile("rest.mustache", packageFolder, "rest.py"));
232234
}
233235

234236
modelPackage = packageName + "." + modelPackage;

0 commit comments

Comments
 (0)