Blob Blame Raw
%global srcname libpysal

Name:           python-%{srcname}
Version:        4.0.1
Release:        2%{?dist}
Summary:        Python Spatial Analysis Library core components

License:        BSD
URL:            https://pysal.org
# PyPI source doesn't include test data or docs.
Source0:        https://github.com/pysal/libpysal/archive/v%{version}/%{srcname}-%{version}.tar.gz
BuildArch:      noarch

BuildRequires:  python3-devel
BuildRequires:  python3dist(geomet)
BuildRequires:  python3dist(geopandas) >= 0.2
BuildRequires:  python3dist(matplotlib) >= 1.5.1
BuildRequires:  python3dist(networkx)
BuildRequires:  python3dist(nose)
BuildRequires:  python3dist(nose-exclude)
BuildRequires:  python3dist(nose-progressive)
#BuildRequires:  python3dist(numba)
BuildRequires:  python3dist(numpy) >= 1.3
BuildRequires:  python3dist(numpydoc)
BuildRequires:  python3dist(pandas)
BuildRequires:  python3dist(rtree) >= 0.8
BuildRequires:  python3dist(scipy) >= 0.11
BuildRequires:  python3dist(setuptools)
BuildRequires:  python3dist(sphinx) >= 1.4.3
BuildRequires:  python3dist(sphinx-bootstrap-theme)
BuildRequires:  python3dist(sphinxcontrib-bibtex)
BuildRequires:  python3dist(sqlalchemy)

%description
Core components of PySAL - A library of spatial analysis functions. Modules
include computational geometry, input and output, spatial weights, and built-in
example datasets.


%package -n     python3-%{srcname}
Summary:        %{summary}
%{?python_provide:%python_provide python3-%{srcname}}

%description -n python3-%{srcname}
Core components of PySAL - A library of spatial analysis functions. Modules
include computational geometry, input and output, spatial weights, and built-in
example datasets.


%package -n     python-%{srcname}-doc
Summary:        Documentation for python-libpysal

%description -n python-%{srcname}-doc
Documentation files for python-libpysal


%prep
%autosetup -n %{srcname}-%{version}

# Remove bundled egg-info
rm -rf %{srcname}.egg-info
rm distribute_setup.py

# Remove executable bits.
chmod -x libpysal/examples/*/*.*

# Fix line endings
for file in \
libpysal/examples/clearwater/clearwater_BS_F.ctl \
libpysal/examples/clearwater/clearwater_BS_F_summary.txt \
libpysal/examples/clearwater/clearwater_BS_NN.ctl \
libpysal/examples/clearwater/clearwater_BS_NN_summary.txt \
libpysal/examples/clearwater/clearwater_GS_F.ctl \
libpysal/examples/clearwater/clearwater_GS_F_summary.txt \
libpysal/examples/clearwater/clearwater_GS_NN.ctl \
libpysal/examples/clearwater/clearwater_GS_NN_summary.txt \
libpysal/examples/clearwater/landslides.csv \
libpysal/examples/geodanet/crimes.shp.xml \
libpysal/examples/geodanet/schools.shp.xml \
libpysal/examples/georgia/GData_utm.csv \
libpysal/examples/georgia/georgia_BS_F.ctl \
libpysal/examples/georgia/georgia_BS_F_summary.txt \
libpysal/examples/georgia/georgia_BS_NN.ctl \
libpysal/examples/georgia/georgia_BS_NN_summary.txt \
libpysal/examples/georgia/georgia_GS_F.ctl \
libpysal/examples/georgia/georgia_GS_F_summary.txt \
libpysal/examples/georgia/georgia_GS_NN.ctl \
libpysal/examples/georgia/georgia_GS_NN_summary.txt \
libpysal/examples/nyc_bikes/nyct2010.shp.xml \
libpysal/examples/sids2/sids2.gal \
libpysal/examples/stl/stl.gal \
libpysal/examples/stl/stl_hom.txt \
libpysal/examples/tokyo/Readme_tokyomortality.txt \
libpysal/examples/tokyo/SampleTokyoMortalityGWPR.ctl \
libpysal/examples/tokyo/Tokyomortality.csv \
libpysal/examples/tokyo/Tokyomortality.txt \
libpysal/examples/tokyo/tokyo_BS_F.ctl \
libpysal/examples/tokyo/tokyo_BS_F_summary.txt \
libpysal/examples/tokyo/tokyo_BS_NN.ctl \
libpysal/examples/tokyo/tokyo_BS_NN_OFF.ctl \
libpysal/examples/tokyo/tokyo_BS_NN_OFF_summary.txt \
libpysal/examples/tokyo/tokyo_BS_NN_summary.txt \
libpysal/examples/tokyo/tokyo_GS_F.ctl \
libpysal/examples/tokyo/tokyo_GS_F_summary.txt \
libpysal/examples/tokyo/tokyo_GS_NN.ctl \
libpysal/examples/tokyo/tokyo_GS_NN_summary.txt \
libpysal/examples/tokyo/tokyomet262.shp.xml \
libpysal/examples/us_income/spi_download.csv \
libpysal/examples/wmat/wmat.dat \
libpysal/examples/wmat/wmat.mtx \
; do
    sed "s|\r||g" ${file} > ${file}.new
    touch -r ${file} ${file}.new
    mv ${file}.new ${file}
done


%build
%py3_build

# generate html docs
PYTHONPATH=${PWD}/build/lib sphinx-build-3 doc html
# remove the sphinx-build leftovers
rm -rf html/.{doctrees,buildinfo}


%install
%py3_install


%check
%{__python3} setup.py test


%files -n python3-%{srcname}
%doc README.rst
%license LICENSE.txt
%{python3_sitelib}/%{srcname}
%{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info

%files -n python-%{srcname}-doc
%doc html libpysal/examples
%license LICENSE.txt


%changelog
* Sat Mar 23 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.0.1-2
- Cleanup rpmlint warnings

* Fri Mar 15 2019 Elliott Sales de Andrade <quantum.analyst@gmail.com> - 4.0.1-1
- Initial package.