@@ -81,11 +81,9 @@ def __init__(
8181 verbose : bool = False
8282 ):
8383
84- #: The repository
85- self .repo_dir = PathPlus (repo_dir )
86-
8784 # Walk up the tree until a "repo_helper.yml" or "git_helper.yml" (old name) file is found.
88- self .repo_dir = traverse_to_file (self .repo_dir , "repo_helper.yml" , "git_helper.yml" )
85+ #: The repository
86+ self .repo_dir : PathPlus = traverse_to_file (PathPlus (repo_dir ), "repo_helper.yml" , "git_helper.yml" )
8987
9088 #: The tag for the wheel
9189 self .tag = "py3-none-any"
@@ -137,31 +135,26 @@ def info_dir(self) -> PathPlus:
137135 return info_dir
138136
139137 @property
140- def pkg_dir (self ) -> Optional [ str ] :
138+ def pkg_dir (self ) -> str :
141139 """
142140 The path of the package directory.
143-
144- Returns :py:obj:`None` if the project only has modules.
145141 """
146142
147- if not self .config ["py_modules" ]:
148- if self .config ["stubs_package" ]:
149- return posixpath .join (self .config ["source_dir" ], f"{ self .config ['import_name' ].replace ('.' , '/' )} -stubs" )
150- else :
151- return posixpath .join (self .config ["source_dir" ], self .config ["import_name" ].replace ("." , "/" ))
152-
153- return None
143+ if self .config ["stubs_package" ]:
144+ return posixpath .join (
145+ self .config ["source_dir" ], f"{ self .config ['import_name' ].replace ('.' , '/' )} -stubs"
146+ )
147+ else :
148+ return posixpath .join (self .config ["source_dir" ], self .config ["import_name" ].replace ("." , "/" ))
154149
155150 def iter_source_files (self ) -> Iterator [PathPlus ]:
156- if self .config ["py_modules" ]:
157- yield from self .config ["py_modules" ]
158- else :
159- pkgdir = self .repo_dir / self .pkg_dir
151+ pkgdir = self .repo_dir / self .pkg_dir
160152
161- for py_pattern in {"**/*.py" , "**/*.pyi" , "**/*.pyx" , "**/py.typed" }:
162- for py_file in pkgdir .rglob (py_pattern ):
163- if "__pycache__" not in py_file .parts :
164- yield py_file
153+ for py_pattern in {"**/*.py" , "**/*.pyi" , "**/*.pyx" , "**/py.typed" }:
154+ for py_file in pkgdir .rglob (py_pattern ):
155+ if "__pycache__" not in py_file .parts :
156+ # ref: https://github.com/python/typeshed/issues/4746
157+ yield py_file # type: ignore
165158
166159 def copy_source (self ) -> None :
167160 """
0 commit comments