Sync from SUSE:SLFO:Main python-fasttext revision 4c666f03b27f27a2826296c9328b7f47

This commit is contained in:
Adrian Schröter 2024-05-03 20:39:54 +02:00
commit a908720e4e
6 changed files with 198 additions and 0 deletions

23
.gitattributes vendored Normal file
View File

@ -0,0 +1,23 @@
## Default LFS
*.7z filter=lfs diff=lfs merge=lfs -text
*.bsp filter=lfs diff=lfs merge=lfs -text
*.bz2 filter=lfs diff=lfs merge=lfs -text
*.gem filter=lfs diff=lfs merge=lfs -text
*.gz filter=lfs diff=lfs merge=lfs -text
*.jar filter=lfs diff=lfs merge=lfs -text
*.lz filter=lfs diff=lfs merge=lfs -text
*.lzma filter=lfs diff=lfs merge=lfs -text
*.obscpio filter=lfs diff=lfs merge=lfs -text
*.oxt filter=lfs diff=lfs merge=lfs -text
*.pdf filter=lfs diff=lfs merge=lfs -text
*.png filter=lfs diff=lfs merge=lfs -text
*.rpm filter=lfs diff=lfs merge=lfs -text
*.tbz filter=lfs diff=lfs merge=lfs -text
*.tbz2 filter=lfs diff=lfs merge=lfs -text
*.tgz filter=lfs diff=lfs merge=lfs -text
*.ttf filter=lfs diff=lfs merge=lfs -text
*.txz filter=lfs diff=lfs merge=lfs -text
*.whl filter=lfs diff=lfs merge=lfs -text
*.xz filter=lfs diff=lfs merge=lfs -text
*.zip filter=lfs diff=lfs merge=lfs -text
*.zst filter=lfs diff=lfs merge=lfs -text

BIN
fastText-0.9.2.tar.gz (Stored with Git LFS) Normal file

Binary file not shown.

12
gcc13-fix.patch Normal file
View File

@ -0,0 +1,12 @@
diff --git a/src/args.cc b/src/args.cc
index 7ac8c2f..0a7e8c6 100644
--- a/src/args.cc
+++ b/src/args.cc
@@ -14,6 +14,7 @@
#include <stdexcept>
#include <string>
#include <unordered_map>
+#include <cstdint>
namespace fasttext {

20
python-fasttext.changes Normal file
View File

@ -0,0 +1,20 @@
-------------------------------------------------------------------
Fri Apr 21 12:24:59 UTC 2023 - Dirk Müller <dmueller@suse.com>
- add sle15_python_module_pythons (jsc#PED-68)
-------------------------------------------------------------------
Mon Mar 6 12:30:34 UTC 2023 - Martin Liška <mliska@suse.cz>
- Add gcc13-fix.patch that fixes upstream issue:
https://github.com/facebookresearch/fastText/issues/1281
-------------------------------------------------------------------
Wed Jun 1 09:51:33 UTC 2022 - Bernhard Wiedemann <bwiedemann@suse.com>
- Add reproducible.patch to not depend on build machine CPU (boo#1100677)
-------------------------------------------------------------------
Tue May 24 18:16:16 UTC 2022 - Matej Cepl <mcepl@suse.com>
- Initial packaging effort for fasttext 0.9.2.

95
python-fasttext.spec Normal file
View File

@ -0,0 +1,95 @@
#
# spec file for package python-fasttext
#
# Copyright (c) 2023 SUSE LLC
#
# 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.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
%{?!python_module:%define python_module() python-%{**} python3-%{**}}
%define modname fastText
# Using annotation futures and dataclasses
%define skip_python36 1
%{?sle15_python_module_pythons}
Name: python-fasttext
Version: 0.9.2
Release: 0
Summary: Library for fast text representation and classification
License: MIT
URL: https://github.com/facebookresearch/fastText
Source: https://github.com/facebookresearch/%{modname}/archive/refs/tags/v%{version}.tar.gz#/%{modname}-%{version}.tar.gz
Patch0: reproducible.patch
Patch1: gcc13-fix.patch
BuildRequires: %{python_module devel}
BuildRequires: %{python_module pip}
BuildRequires: %{python_module pybind11-devel}
BuildRequires: %{python_module setuptools}
BuildRequires: %{python_module wheel}
BuildRequires: gcc-c++
BuildRequires: python-rpm-macros
# SECTION test requirements
BuildRequires: %{python_module numpy}
BuildRequires: %{python_module pybind11 >= 2.2}
BuildRequires: %{python_module setuptools >= 0.7.0}
# /SECTION
BuildRequires: fdupes
Requires: python-numpy
Requires: python-pybind11 >= 2.2
Requires: python-setuptools >= 0.7.0
Requires(post): update-alternatives
Requires(postun):update-alternatives
%python_subpackages
%description
fastText is a library for efficient learning of word
representations and sentence classification.
%prep
%autosetup -p1 -n %{modname}-%{version}
sed -Ei "1{/^#!\/usr\/bin\/env python/d}" \
python/fasttext_module/fasttext/util/util.py
%build
export CXXFLAGS="%{optflags}" CFLAGS="%{optflags}"
%make_build
%pyproject_wheel
%install
%pyproject_install
%{python_expand :
install -Dpm 0755 fasttext %{buildroot}%{_bindir}/fasttext
%python_clone -a %{buildroot}%{_bindir}/fasttext
%fdupes %{buildroot}%{$python_sitearch}
}
%check
# Tests require 300+MB test data
%post
%python_install_alternative fasttext
%postun
%python_uninstall_alternative fasttext
%files %{python_files}
%doc README.md docs/
%license LICENSE
# fasttext.pc.in
%python_alternative %{_bindir}/fasttext
%{python_sitearch}/fasttext
%{python_sitearch}/fasttext-%{version}*-info
%{python_sitearch}/fasttext_pybind.*.so
%changelog

45
reproducible.patch Normal file
View File

@ -0,0 +1,45 @@
Date: 2022-06-01
Author: Bernhard M. Wiedemann
disable march=native to avoid
https://bugzilla.opensuse.org/show_bug.cgi?id=1100677 packages do not build reproducibly from compile-time CPU-detection
Index: fastText-0.9.2/CMakeLists.txt
===================================================================
--- fastText-0.9.2.orig/CMakeLists.txt
+++ fastText-0.9.2/CMakeLists.txt
@@ -15,7 +15,7 @@ set (fasttext_VERSION_MINOR 1)
include_directories(fasttext)
-set(CMAKE_CXX_FLAGS " -pthread -std=c++11 -funroll-loops -O3 -march=native")
+set(CMAKE_CXX_FLAGS " -pthread -std=c++11 -funroll-loops -O3")
set(HEADER_FILES
src/args.h
Index: fastText-0.9.2/setup.py
===================================================================
--- fastText-0.9.2.orig/setup.py
+++ fastText-0.9.2/setup.py
@@ -76,7 +76,7 @@ ext_modules = [
],
language='c++',
extra_compile_args=["-O0 -fno-inline -fprofile-arcs -pthread -march=native" if coverage else
- "-O3 -funroll-loops -pthread -march=native"],
+ "-O3 -funroll-loops -pthread"],
),
]
Index: fastText-0.9.2/Makefile
===================================================================
--- fastText-0.9.2.orig/Makefile
+++ fastText-0.9.2/Makefile
@@ -7,7 +7,7 @@
#
CXX = c++
-CXXFLAGS = -pthread -std=c++11 -march=native
+CXXFLAGS = -pthread -std=c++11
OBJS = args.o autotune.o matrix.o dictionary.o loss.o productquantizer.o densematrix.o quantmatrix.o vector.o model.o utils.o meter.o fasttext.o
INCLUDES = -I.