2017-05-16 15:55:23 +00:00
#
# spec file for package python-pymisp
#
2024-09-03 16:26:23 +00:00
# Copyright (c) 2024 SUSE LLC
2017-05-16 15:55:23 +00:00
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
2018-09-22 08:51:16 +00:00
# Please submit bugfixes or comments via https://bugs.opensuse.org/
2017-09-07 20:06:56 +00:00
#
2017-05-16 15:55:23 +00:00
2020-01-18 10:29:37 +00:00
%define skip_python2 1
2024-11-15 06:43:01 +00:00
%define misp_objects_revision 83271573312aebce971a0cf7ffbd04e784a58de3
2017-05-16 15:55:23 +00:00
Name : python-pymisp
2024-11-15 06:43:01 +00:00
Version : 2.5.1
2017-05-16 15:55:23 +00:00
Release : 0
Summary : Python API for MISP
2017-09-07 20:06:56 +00:00
License : BSD-2-Clause
2017-05-16 15:55:23 +00:00
Group : Development/Languages/Python
2019-03-16 11:14:37 +00:00
URL : https://github.com/MISP/PyMISP
2020-03-17 14:32:41 +00:00
Source0 : https://github.com/MISP/PyMISP/archive/v%{version} .tar.gz#/%{name}-%{version}.tar.gz
# github tarball misses the misp-objects subproject data
2020-05-21 13:49:26 +00:00
Source1 : https://github.com/MISP/misp-objects/archive/%{misp_objects_revision} .tar.gz#/misp-objects.tar.gz
2020-03-17 14:32:41 +00:00
# pypi tarball missing some files: https://github.com/MISP/PyMISP/issues/554
#Source: https://files.pythonhosted.org/packages/source/p/pymisp/pymisp-%%{version}.tar.gz
2020-05-21 13:49:26 +00:00
# packaging tool
Source2 : update-misp-objects.sh
2024-09-04 05:48:10 +00:00
Source3 : python-pymisp-doc-rpmlintrc
2023-08-12 06:30:21 +00:00
BuildRequires : %{python_module base >= 3.8}
2024-09-03 16:26:23 +00:00
BuildRequires : %{python_module pip}
BuildRequires : %{python_module poetry-core}
2017-05-16 15:55:23 +00:00
BuildRequires : %{python_module setuptools}
2024-09-03 16:26:23 +00:00
BuildRequires : %{python_module wheel}
2017-09-07 20:06:56 +00:00
BuildRequires : fdupes
BuildRequires : python-rpm-macros
2023-08-12 06:30:21 +00:00
Recommends: python-oletools
Requires : python-Deprecated >= 1.2.14
Requires : python-python-dateutil >= 2.8.2
Requires : python-requests >= 2.31.0
2019-03-16 11:14:37 +00:00
Recommends: %{name} -doc
2021-04-06 20:56:01 +00:00
Recommends: python-extract-msg >= 0.28.0
2023-08-12 06:30:21 +00:00
Recommends: python-magic >= 0.4.27
2021-02-20 14:22:05 +00:00
Recommends: python-reportlab
2023-08-12 06:30:21 +00:00
Recommends: python3-beautifulsoup4 >= 4.12.2
Recommends: python3-publicsuffixlist
Recommends: python3-urllib3
Recommends: python3-validators >= 0.20.0
2019-03-16 11:14:37 +00:00
Suggests : python-pydeep
2023-08-12 06:30:21 +00:00
# Other optional requirements which are unavailable in Tumbleweed
#extract_msg = {version = "^0.42.1", optional = true}
#RTFDE = {version = "^0.1.0", optional = true}
#pydeep2 = {version = "^0.5.1", optional = true}
#lief = {version = "^0.13.2", optional = true}
#pyfaup = {version = "^1.2", optional = true}
2019-03-16 11:14:37 +00:00
BuildArch : noarch
2018-09-22 08:51:16 +00:00
# SECTION tests
2023-08-12 06:30:21 +00:00
BuildRequires : %{python_module Deprecated >= 1.2.14}
2021-02-20 14:22:05 +00:00
BuildRequires : %{python_module oletools}
2021-12-14 10:10:27 +00:00
BuildRequires : %{python_module pytest}
2023-08-12 06:30:21 +00:00
BuildRequires : %{python_module python-dateutil >= 2.8.2}
BuildRequires : %{python_module python-magic >= 0.4.27}
2021-02-20 14:22:05 +00:00
BuildRequires : %{python_module reportlab}
2023-08-12 06:30:21 +00:00
BuildRequires : %{python_module requests >= 2.31.0}
2017-09-07 20:06:56 +00:00
BuildRequires : %{python_module requests-mock}
2018-09-22 08:51:16 +00:00
# /SECTION
2017-09-07 20:06:56 +00:00
# SECTION docs
BuildRequires : python3-CommonMark
BuildRequires : python3-Sphinx
2023-08-12 06:30:21 +00:00
BuildRequires : python3-recommonmark >= 0.7.1
2019-03-23 14:39:03 +00:00
BuildRequires : python3-sphinx-autodoc-typehints
2017-09-07 20:06:56 +00:00
# /SECTION
2017-05-16 15:55:23 +00:00
%python_subpackages
2024-09-03 16:26:23 +00:00
%{?python_enable_dependency_generator}
2017-05-16 15:55:23 +00:00
2017-09-07 20:06:56 +00:00
%package -n %{name}-doc
Summary : Examples and Documentation for %{name}
Group : Documentation/HTML
2017-05-16 15:55:23 +00:00
2017-09-07 20:06:56 +00:00
%description
2017-05-16 15:55:23 +00:00
PyMISP is a Python library to access MISP platforms via their REST API.
PyMISP allows you to fetch events, add or update events/attributes, add or update samples or search for attributes.
2017-09-07 20:06:56 +00:00
%description -n %{name}-doc
Examples and HTML documentation for %{name} .
2017-05-16 15:55:23 +00:00
%prep
2020-03-17 14:32:41 +00:00
%setup -q -n PyMISP-%{version}
%setup -T -D -b 1 -n PyMISP-%{version}
mv ../misp-objects-*/* pymisp/data/misp-objects/
2017-09-20 09:43:15 +00:00
find pymisp examples -name " * . p y " -type f -exec sed -i '1s/^#!.*//' '{}' \+
2024-09-03 16:26:23 +00:00
find examples pymisp/data/misp-objects pymisp/tools -name " * . p y " -type f -exec chmod -x '{}' \+
# https://github.com/MISP/PyMISP/issues/1295
sed -i '/CHANGELOG.txt/d' pyproject.toml
2024-09-04 06:36:18 +00:00
# remove the date from python-publicsuffixlist's version. the package python-publicsuffixlist in openSUSE uses the suffix list from the package publicsuffixlist, not the list packaged by python-publicsuffixlist
sed -i -r '/publicsuffixlist/ s/(version *= *"\^[0-9]+\.[0-9]\.[0-9]+)\.[0-9]{8}/\1/' pyproject.toml
2017-05-16 15:55:23 +00:00
%build
2024-09-03 16:26:23 +00:00
%pyproject_wheel
2017-09-07 20:06:56 +00:00
pushd docs
export LANG=en_US.UTF-8
2019-03-16 11:14:37 +00:00
make %{?_smp_mflags} html
2017-09-07 20:06:56 +00:00
rm build/html/.buildinfo
popd
2017-05-16 15:55:23 +00:00
%install
2024-09-03 16:26:23 +00:00
%pyproject_install
2020-04-20 10:33:55 +00:00
%python_expand %fdupes %{buildroot} %{$python_sitelib}
2017-09-07 20:06:56 +00:00
%check
2020-03-17 14:49:48 +00:00
export LANG=en_US.UTF-8
2021-02-20 14:22:05 +00:00
# requires optional dependencies which we don't have (extract_msg, RTFDE etc.)
rm tests/test_emailobject.py
%pytest
2017-05-16 15:55:23 +00:00
%files %{python_files}
2017-09-07 20:06:56 +00:00
%doc README.md
2017-09-20 09:43:15 +00:00
%license LICENSE
2023-08-12 06:30:21 +00:00
%{python_sitelib} /pymisp/
%{python_sitelib} /pymisp-%{version} *-info
2017-05-16 15:55:23 +00:00
2017-09-07 20:06:56 +00:00
%files -n %{name}-doc
%doc examples docs/build/html
2017-05-16 15:55:23 +00:00
%changelog