orion / rpms / conda

Forked from rpms/conda 6 years ago
Clone
Blob Blame History Raw
%{!?_with_bootstrap: %global bootstrap 0}

Name:           conda
Version:        4.3.24
Release:        3%{?dist}
Summary:        Cross-platform, Python-agnostic binary package manager

License:        BSD and ASL 2.0 and LGPLv2+ and MIT
# The conda code is BSD
# progressbar is LGPLv2+
# six is MIT/X11
# adapters/ftp.py is ASL 2.0

URL:            http://conda.pydata.org/docs/
Source0:        https://github.com/conda/conda/archive/%{version}/%{name}-%{version}.tar.gz
# Source0:        https://pypi.io/packages/source/c/%{name}/%{name}-%{version}.tar.gz
Patch0:         conda_sys_prefix.patch

BuildArch:      noarch

Requires:       python3-conda = %{version}-%{release}

BuildRequires:  sed

%global _description \
Conda is a cross-platform, Python-agnostic binary package manager. It is the\
package manager used by Anaconda installations, but it may be used for other\
systems as well. Conda makes environments first-class citizens, making it easy\
to create independent environments even for C libraries. Conda is written\
entirely in Python.

%description %_description

%global _py2_reqs \
        python2-crypto \
        python2-pycosat \
        python2-ruamel-yaml \
        python2-mock \
        python2-responses

%global _py2_bund \
        bundled(python2-appdirs) = 1.2.0 \
        bundled(python2-auxlib) \
        bundled(python2-boltons) = 16.5.1 \
        bundled(python2-six) = 1.10.0 \
        bundled(python2-toolz) = 0.8.0 \
        bundled(python2-urllib3) = 1.19.1

%global py2_reqs %(c="%_py2_reqs"; echo "$c" | xargs)
%global py3_reqs %(c="%_py2_reqs"; echo "$c" | sed s/python2/python%{python3_pkgversion}/ | xargs)

%global py2_bund %(c="%_py2_bund"; echo "$c" | xargs)
%global py3_bund %(c="%_py2_bund"; echo "$c" | sed s/python2/python%{python3_pkgversion}/ | xargs)

%package -n python2-conda
Summary:        %{summary}

BuildRequires:  python-devel
BuildRequires:  python-setuptools
BuildRequires:  %py2_reqs
BuildRequires:  python-requests
BuildRequires:  PyYAML
# For tests
BuildRequires:  python2-pytest-cov

Requires:       %py2_reqs
Requires:       python-requests
Requires:       PyYAML
Provides:       %py2_bund
%{?python_provide:%python_provide python2-conda}

%description -n python2-conda %_description

%package -n python%{python3_pkgversion}-conda
Summary:        %{summary}

BuildRequires:  python%{python3_pkgversion}-devel
BuildRequires:  python%{python3_pkgversion}-setuptools
BuildRequires:  %py3_reqs
BuildRequires:  python%{python3_pkgversion}-requests
BuildRequires:  python%{python3_pkgversion}-yaml
# For tests
BuildRequires:  python%{python3_pkgversion}-pytest-cov

Requires:       %py3_reqs
Requires:       python%{python3_pkgversion}-requests
Requires:       python%{python3_pkgversion}-yaml
Provides:       %py3_bund
%{?python_provide:%python_provide python%{python3_pkgversion}-conda}

%description -n python%{python3_pkgversion}-conda %_description

%package activate
Summary:        Activate conda environments in shell
Requires:       %{name} = %{version}-%{release}

%description activate
This package provides scripts that can be sourced in a shell to
activate and dectivate a specific conda environment by setting $PATH
and other shell variables.

%prep
%autosetup -p1

sed -r -i 's/^(__version__ = ).*/\1"%{version}"/' conda/__init__.py

# disable some stupid tests which fail with EXDEV
sed -r -i 's/test_trash_outside_prefix/_disabled_\0/' tests/test_install.py
sed -r -i 's/test_move_to_trash|test_move_path_to_trash_couldnt/_disabled_\0/' tests/gateways/disk/test_delete.py

# delete interpreter line, the user can always call the file
# explicitly as python3 /usr/lib/python3.6/site-packages/conda/_vendor/appdirs.py
# or so.
sed -r -i '1 {/#![/]usr[/]bin[/]env/d}' conda/_vendor/appdirs.py

%build
%py2_build
%py3_build

# build activate/deactivate
%define py_setup utils/setup-testing.py
%py2_build
%py3_build

%install
%if 0%{?fedora}
%py2_install
%py3_install
%else
%py3_install
%py2_install
%endif

# install activate/deactivate
%define py_setup utils/setup-testing.py
%if 0%{?fedora}
%py2_install
%py3_install
%else
%py3_install
%py2_install
%endif

mkdir -p %{buildroot}%{_datadir}/conda/condarc.d
cat >%{buildroot}%{_datadir}/conda/condarc.d/defaults.yaml <<EOF
pkgs_dirs:
 - /var/cache/conda/pkgs
 - ~/.conda/pkgs
EOF

mkdir -p %{buildroot}%{_localstatedir}/cache/conda/pkgs/cache

%check
# integration tests generally require network, so skip them
export PATH=%{buildroot}%{_bindir}:$PATH
py.test-%{python2_version} -vv -m "not integration"
py.test-%{python3_version} -vv -m "not integration"

%files
%{_bindir}/conda
%{_bindir}/conda-env

%files activate
%{_bindir}/activate
%{_bindir}/deactivate

%files -n python2-conda
%license LICENSE.txt
%doc CHANGELOG.md README.rst
%{python2_sitelib}/conda/
%{python2_sitelib}/conda_env/
%{python2_sitelib}/*.egg-info
%{_localstatedir}/cache/conda/
%{_datadir}/conda/

%files -n python%{python3_pkgversion}-conda
%license LICENSE.txt
%doc CHANGELOG.md README.rst
%{python3_sitelib}/conda/
%{python3_sitelib}/conda_env/
%{python3_sitelib}/*.egg-info
%{_localstatedir}/cache/conda/
%{_datadir}/conda/


%changelog
* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 4.3.24-3
- Install just one version of the executables (python 2 or 3)

* Sun Aug 20 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 4.3.24-2
- Add all licenses to the License tag
- Add Provides: bundled(...) for all the "vendored" dependencies
- Update descriptions and simplify the spec file a bit
- Move condarc.d directory under /usr/share/conda

* Thu Aug  3 2017 Zbigniew Jędrzejewski-Szmek <zbyszek@in.waw.pl> - 4.3.24-1
- Update to latest version
- Switch /usr/bin/conda to python3

* Thu Jul 21 2016 Orion Poplawski <orion@cora.nwra.com> - 4.1.6-1
- Update to 4.1.6

* Thu Dec 31 2015 Orion Poplawski <orion@cora.nwra.com> - 3.19.0-1
- Update to 3.19.0

* Thu Dec 31 2015 Orion Poplawski <orion@cora.nwra.com> - 3.18.8-2
- Add python 3 version

* Mon Dec 7 2015 Orion Poplawski <orion@cora.nwra.com> - 3.18.8-1
- Update to 3.18.8

* Thu Sep 24 2015 Orion Poplawski <orion@cora.nwra.com> - 3.17.0-6
- Do not create broken symlinks if activate/deactivate are not installed
- Do not create /usr/conda-meta to prevent accidental installs into system

* Thu Sep 24 2015 Orion Poplawski <orion@cora.nwra.com> - 3.17.0-5
- Non-bootstrap build

* Wed Sep 23 2015 Orion Poplawski <orion@cora.nwra.com> - 3.17.0-4
- Add patch to support rootless mode
- Require python-crypto
- Create /usr/conda-meta, /usr/.condarc, /var/cache/conda

* Tue Sep 22 2015 Orion Poplawski <orion@cora.nwra.com> - 3.17.0-3
- Require python-requests, python-yaml

* Tue Sep 22 2015 Orion Poplawski <orion@cora.nwra.com> - 3.17.0-2
- Add patch to allow overriding pkgs_dirs in .condarc

* Mon Sep 21 2015 Orion Poplawski <orion@cora.nwra.com> - 3.17.0-1
- Initial package