@@ -649,7 +649,7 @@ def PackageInfo(self, pythonDir, versionString=None):
649649 versionString = _get_version_string (versionString )
650650
651651 if not os .path .exists (pythonDir ):
652- return
652+ return []
653653
654654 # Some information can come from the pyproject file.
655655 toml_metadata = {}
@@ -659,18 +659,19 @@ def PackageInfo(self, pythonDir, versionString=None):
659659 with open ("pyproject.toml" , "rb" ) as fd :
660660 toml_metadata = tomllib .load (fd )
661661
662+ toml_project = toml_metadata .get ("project" , {})
662663 pythonPackageName = ""
663- if "project" in toml_metadata and " name" in toml_metadata [ "project" ] :
664- pythonPackageName = toml_metadata [ "project" ] ["name" ]
664+ if "name" in toml_project :
665+ pythonPackageName = toml_project ["name" ]
665666 else :
666667 if os .path .exists (os .path .join (pythonDir , "lsst" )):
667668 pythonPackageName = "lsst_" + state .env ["packageName" ]
668669 else :
669670 pythonPackageName = state .env ["packageName" ]
670671 pythonPackageName = pythonPackageName .replace ("_" , "-" )
671672 # The directory name is required to use "_" instead of "-"
672- eggDir = os .path .join (pythonDir , f"{ pythonPackageName .replace ('-' , '_' )} .dist-info" )
673- filename = os .path .join (eggDir , "METADATA" )
673+ distDir = os .path .join (pythonDir , f"{ pythonPackageName .replace ('-' , '_' )} .dist-info" )
674+ filename = os .path .join (distDir , "METADATA" )
674675 oldMd5 = _calcMd5 (filename )
675676
676677 def makePackageMetadata (target , source , env ):
@@ -695,12 +696,9 @@ def makePackageMetadata(target, source, env):
695696 )
696697
697698 # Create the entry points file if defined in the pyproject.toml file.
698- entryPoints = {}
699- if "project" in toml_metadata and "entry-points" in toml_metadata ["project" ]:
700- entryPoints = toml_metadata ["project" ]["entry-points" ]
701-
699+ entryPoints = toml_project .get ("entry-points" , {})
702700 if entryPoints :
703- filename = os .path .join (eggDir , "entry_points.txt" )
701+ filename = os .path .join (distDir , "entry_points.txt" )
704702 oldMd5 = _calcMd5 (filename )
705703
706704 def makeEntryPoints (target , source , env ):
0 commit comments