11#! /usr/bin/env python
22
33import os
4- import setuptools # noqa; we are using a setuptools namespace
4+ import re
5+ from pathlib import Path
6+
57from setuptools import setup
68
79
810descr = """Preconditoned ICA for Real Data"""
911
1012version = None
11- with open (os .path .join ('picard' , '__init__.py' ), 'r' ) as fid :
12- for line in (line .strip () for line in fid ):
13- if line .startswith ('__version__' ):
14- version = line .split ('=' )[1 ].strip ().strip ('\' ' )
15- break
13+ for line in (Path ('picard' ) / '__init__.py' ).read_text ("utf-8" ).splitlines ():
14+ if line .startswith ('__version__' ):
15+ version = line .split ('=' )[1 ].strip ().strip ('\' ' )
16+ break
1617if version is None :
1718 raise RuntimeError ('Could not determine version' )
1819
@@ -38,6 +39,9 @@ def package_tree(pkgroot):
3839
3940
4041if __name__ == "__main__" :
42+ long_description = Path ('README.rst' ).read_text ("utf-8" )
43+ # Remove scale for PyPI
44+ long_description = re .sub (r"\s+:scale:.*\n" , "\n " , long_description )
4145 setup (name = DISTNAME ,
4246 maintainer = MAINTAINER ,
4347 maintainer_email = MAINTAINER_EMAIL ,
@@ -46,7 +50,7 @@ def package_tree(pkgroot):
4650 version = VERSION ,
4751 url = URL ,
4852 download_url = DOWNLOAD_URL ,
49- long_description = open ( 'README.rst' ). read () ,
53+ long_description = long_description ,
5054 long_description_content_type = 'text/x-rst' ,
5155 classifiers = ['Intended Audience :: Science/Research' ,
5256 'Intended Audience :: Developers' ,
0 commit comments