- # Set self.build_lib to match whatever the build_py subcommand uses.
- self.set_undefined_options('build_py', ('build_lib', 'build_lib'))
- if self.discovery_json is None and self.DEFAULT_JSON_PATH.exists():
- self.discovery_json = str(self.DEFAULT_JSON_PATH)
- out_path = Path(self.discovery_output)
- if out_path.is_absolute():
- raise Exception("--discovery-output should be a relative path")
- else:
- self.out_path = Path(self.build_lib, out_path)
+ super().finalize_options()
+ self.json_path = self._relative_path(self.discovery_json, 'discovery-json')
+ self.out_path = Path(
+ self.build_lib,
+ self._relative_path(self.discovery_output, 'discovery-output'),
+ )