Browse Source

add README and LICENSE file to MANIFEST.in as well

shut-new-model
Niklas Rosenstein 9 months ago
parent
commit
340a1afb1e
No known key found for this signature in database GPG Key ID: 6D269B33D25F6C6
3 changed files with 20 additions and 7 deletions
  1. + 3
    - 1
      MANIFEST.in
  2. + 7
    - 0
      src/shut/model/package.py
  3. + 10
    - 6
      src/shut/update/setuptools.py

+ 3
- 1
MANIFEST.in

@ -1,3 +1,5 @@
# This section is auto-generated by Shut. DO NOT EDIT {
include package.yaml
package.yaml
README.md
LICENSE.txt
# }

+ 7
- 0
src/shut/model/package.py

@ -163,6 +163,13 @@ class PackageModel(AbstractProjectModel):
prefix='LICENSE.',
preferred=['LICENSE', 'LICENSE.txt', 'LICENSE.rst', 'LICENSE.md'])
def get_py_typed_file(self) -> Optional[str]:
if not self.data.typed:
return None
directory = package.get_python_package_metadata().package_directory
return os.path.join(directory, 'py.typed')
# AbstractProjectModel
def get_name(self) -> str:

+ 10
- 6
src/shut/update/setuptools.py

@ -359,14 +359,18 @@ class SetuptoolsRenderer(Renderer[PackageModel]):
is up to date (or added if it didn't exist before).
"""
manifest = [
'include ' + os.path.relpath(package.filename, package.get_directory()),
files = [
package.filename,
package.get_readme_file(),
package.get_license_file(),
package.get_py_typed_file(),
]
if package.data.typed:
directory = package.get_python_package_metadata().package_directory
directory = os.path.relpath(directory, package.get_directory())
manifest.append('include ' + os.path.join(directory, 'py.typed'))
manifest = [
os.path.relpath(f, package.get_directory())
for f in files
if f
]
markers = (self._BEGIN_SECTION, self._END_SECTION)
with _rewrite_section(fp, current.read() if current else '', *markers):

Loading…
Cancel
Save