Blob Blame History Raw
Name:           python-music21
Version:        2.2.1
Release:        20%{?dist}
Summary:        A toolkit for computational musicology

License:        BSD or LGPLv3
URL:            http://web.mit.edu/music21/
Source0:        https://github.com/cuthbertLab/music21/releases/download/v.%{version}/music21-%{version}.tar.gz

Patch0:         0001-Use-sensible-default-on-nix.patch
Patch1:         0002-Do-not-use-a-predicatable-directory-name-for-the-scr.patch
Patch2:         0003-Use-system-six-in-docstring.patch

BuildRequires:  lilypond
BuildRequires:  mscore
BuildRequires:  xorg-x11-server-Xvfb
BuildRequires:  dos2unix

BuildArch:      noarch

# Use the same directory of the main package for subpackage licence and docs
%global _docdir_fmt %{name}

# Non-standard locations should be byte-compiled are handled below
%global _python_bytecompile_extra 0

%description
Music21 is a set of tools for helping scholars and other active
listeners answer questions about music quickly and simply. It
supports input of melodies in shorthand notation, printing of
musical scores, etc.

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

BuildRequires:  python3-devel
BuildRequires:  python3-jsonpickle
BuildRequires:  python3-chardet
BuildRequires:  python3-mock
BuildRequires:  python3-webcolors
BuildRequires:  python3-xlrd
BuildRequires:  python3-six
BuildRequires:  python3-pillow
BuildRequires:  python3-matplotlib
BuildRequires:  python3-chardet
BuildRequires:  python3-numpy
BuildRequires:  python3-scipy
Requires:       python3-chardet
Requires:       python3-jsonpickle
Requires:       python3-mock
Requires:       python3-webcolors
Requires:       python3-xlrd
Requires:       python3-six
Requires:       python3-pillow
Requires:       python3-matplotlib
# Requires:       python3-pyaudio
Requires:       python3-numpy
Requires:       python3-scipy
Requires:       lilypond
Requires:       mscore
Requires:       %{name}-common = %{version}-%{release}
Suggests:       %{name}-doc

%description -n python3-music21
Music21 is a set of tools for helping scholars and other active
listeners answer questions about music quickly and simply. It
supports input of melodies in shorthand notation, printing of
musical scores, etc.

%package common
Summary: Music corpus and other shared files for music21

%description common
This package contains shared files for %{name} and python3-music21.

%package doc
Summary: Documentation for music21

%description doc
This package contains HTML documentation for %{name} and python3-music21.

%prep
%autosetup -n music21-%{version} -p1

rm -r music21/ext -r
sed -i 's/from music21.ext.nbconvert/from IPython.html.nbconvert/' music21/documentation/writers.py
find music21 -name '*.py' -exec sed -i '
     s/from music21.ext import/import/;
     s/from music21.ext.six import/from six import/;
     ' {} \;
find music21 -name '*.py' -exec sed -i '' {} \;

sed -i 1d \
    music21/alpha/trecento/exceldiff.py \
    music21/demos/josquin/label_intervals.py \
    music21/alpha/trecento/findTrecentoFragments.py

dos2unix music21/documentation/build/html/_sources/tutorials/advancedGraphing.txt

%build
%py3_build

%install
%py3_install

mkdir -p %{buildroot}%{_pkgdocdir}
mv %{buildroot}%{python3_sitelib}/music21/documentation/build/html %{buildroot}%{_pkgdocdir}/
# source is kept around so tests can pass
rm -r %{buildroot}%{python3_sitelib}/music21/documentation/build

mkdir -p %{buildroot}%{_datadir}/music21/corpus \
         %{buildroot}%{_datadir}/music21/scale/scala
mv -v %{buildroot}%{python3_sitelib}/music21/corpus/[a-z]*/ \
      %{buildroot}%{_datadir}/music21/corpus/
mv -v %{buildroot}%{python3_sitelib}/music21/scale/scala/scl \
      %{buildroot}%{_datadir}/music21/scale/scala/

ln -sv --relative %{buildroot}%{_datadir}/music21/corpus/* %{buildroot}%{python3_sitelib}/music21/corpus/
ln -sv --relative %{buildroot}%{_datadir}/music21/scale/scala/scl %{buildroot}%{python3_sitelib}/music21/scale/scala/

%py_byte_compile %{__python3} %{buildroot}%{_datadir}/music21/

%check
mkdir -p ~/Desktop
PYTHONPATH=%{buildroot}%{python3_sitelib} \
LC_ALL=C.utf8 \
    xvfb-run -a \
    %{__python3} -c 'from music21.test.multiprocessTest import mainPoolRunner as tm; tm()'

%files -n python3-music21
%{python3_sitelib}/music21/
%{python3_sitelib}/*.egg-info
%exclude %{python3_sitelib}/music21/documentation/source
%exclude %{python3_sitelib}/music21/documentation/autogenerated
%exclude %{python3_sitelib}/music21/LICENSE

%files common
%license LICENSE
%doc README.md
%{_datadir}/music21/

%files doc
%license LICENSE
%doc README.md
%{_pkgdocdir}/html/

%changelog
* Wed Jul 29 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-20
- Rebuilt for https://fedoraproject.org/wiki/Fedora_33_Mass_Rebuild

* Tue May 26 2020 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-19
- Rebuilt for Python 3.9

* Thu Jan 30 2020 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-18
- Rebuilt for https://fedoraproject.org/wiki/Fedora_32_Mass_Rebuild

* Thu Oct 03 2019 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-17
- Rebuilt for Python 3.8.0rc1 (#1748018)

* Mon Aug 19 2019 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-16
- Rebuilt for Python 3.8

* Fri Jul 26 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-15
- Rebuilt for https://fedoraproject.org/wiki/Fedora_31_Mass_Rebuild

* Sat Feb 02 2019 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-14
- Rebuilt for https://fedoraproject.org/wiki/Fedora_30_Mass_Rebuild

* Wed Oct 17 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.1-13
- Subpackage python2-music21 has been removed
  See https://fedoraproject.org/wiki/Changes/Mass_Python_2_Package_Removal

* Thu Jul 26 2018 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.1-12
- Byte-compile the shared dir explicitly

* Sat Jul 14 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-11
- Rebuilt for https://fedoraproject.org/wiki/Fedora_29_Mass_Rebuild

* Tue Jun 19 2018 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-10
- Rebuilt for Python 3.7

* Fri Feb 09 2018 Iryna Shcherbina <ishcherb@redhat.com> - 2.2.1-9
- Update Python 2 dependency declarations to new packaging standards
  (See https://fedoraproject.org/wiki/FinalizingFedoraSwitchtoPython3)

* Fri Feb 09 2018 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-8
- Rebuilt for https://fedoraproject.org/wiki/Fedora_28_Mass_Rebuild

* Thu Jul 27 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-7
- Rebuilt for https://fedoraproject.org/wiki/Fedora_27_Mass_Rebuild

* Sat Feb 11 2017 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-6
- Rebuilt for https://fedoraproject.org/wiki/Fedora_26_Mass_Rebuild

* Mon Dec 19 2016 Miro Hrončok <mhroncok@redhat.com> - 2.2.1-5
- Rebuild for Python 3.6

* Mon Sep 26 2016 Dominik Mierzejewski <rpm@greysector.net> - 2.2.1-4
- rebuilt for matplotlib-2.0.0

* Tue Jul 19 2016 Fedora Release Engineering <rel-eng@lists.fedoraproject.org> - 2.2.1-3
- https://fedoraproject.org/wiki/Changes/Automatic_Provides_for_Python_RPM_Packages

* Thu Feb 04 2016 Fedora Release Engineering <releng@fedoraproject.org> - 2.2.1-2
- Rebuilt for https://fedoraproject.org/wiki/Fedora_24_Mass_Rebuild

* Sat Dec  5 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.2.1-1
- Update to latest version

* Sat Dec  5 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.1.2-2
- Use Suggests for documentation
- Move common files to python3 directory
- Fix some encodings and file headers

* Mon Oct  5 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.1.2-1
- Update to latest version
- Use new python packaging macros

* Fri Jul 10 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.5-2
- Switch to pypi tarball
- Untabify and escape macros in comments

* Fri Jun 19 2015 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 2.0.5-1
- Initial packaging