@autorest/python 6.2.7 → 6.2.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -142,7 +142,7 @@ class JinjaSerializer(ReaderAndWriter): # pylint: disable=abstract-method
142
142
  namespace_path = (
143
143
  Path(".")
144
144
  if self.code_model.options["no_namespace_folders"]
145
- else Path(*(self.code_model.namespace.split(".")))
145
+ else Path(*self._name_space().split("."))
146
146
  )
147
147
 
148
148
  p = namespace_path.parent
@@ -532,9 +532,17 @@ class JinjaSerializer(ReaderAndWriter): # pylint: disable=abstract-method
532
532
  namespace_path / Path("_metadata.json"), metadata_serializer.serialize()
533
533
  )
534
534
 
535
+ def _name_space(self) -> str:
536
+ if self.code_model.namespace.count(".") >= (
537
+ self.code_model.options["package_name"] or ""
538
+ ).count("-"):
539
+ return self.code_model.namespace
540
+
541
+ return self.code_model.options["package_name"].replace("-", ".")
542
+
535
543
  # find root folder where "setup.py" is
536
544
  def _package_root_folder(self, namespace_path: Path) -> Path:
537
- return namespace_path / Path("../" * (self.code_model.namespace.count(".") + 1))
545
+ return namespace_path / Path("../" * (self._name_space().count(".") + 1))
538
546
 
539
547
  def _serialize_and_write_sample(self, env: Environment, namespace_path: Path):
540
548
  out_path = self._package_root_folder(namespace_path) / Path("generated_samples")
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@autorest/python",
3
- "version": "6.2.7",
3
+ "version": "6.2.8",
4
4
  "description": "The Python extension for generators in AutoRest.",
5
5
  "repository": {
6
6
  "type": "git",