summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--.gitignore1
-rw-r--r--0001-disable-submodule.patch49
-rw-r--r--python-torchtext.spec12
-rw-r--r--sources1
4 files changed, 62 insertions, 1 deletions
diff --git a/.gitignore b/.gitignore
index cd8813b..3543aff 100644
--- a/.gitignore
+++ b/.gitignore
@@ -1 +1,2 @@
/text-0.16.2.tar.gz
+/sentencepiece.zip
diff --git a/0001-disable-submodule.patch b/0001-disable-submodule.patch
new file mode 100644
index 0000000..92d43da
--- /dev/null
+++ b/0001-disable-submodule.patch
@@ -0,0 +1,49 @@
+diff --git a/setup.py b/setup.py
+index d008cb9c9..f4d455a65 100644
+--- a/setup.py
++++ b/setup.py
+@@ -93,7 +93,7 @@ class clean(distutils.command.clean.clean):
+ shutil.rmtree(str(path), ignore_errors=True)
+
+
+-_init_submodule()
++# _init_submodule()
+ setup_info = dict(
+ # Metadata
+ name="torchtext",
+diff --git a/third_party/CMakeLists.txt b/third_party/CMakeLists.txt
+index f21199723..aef30499a 100644
+--- a/third_party/CMakeLists.txt
++++ b/third_party/CMakeLists.txt
+@@ -5,7 +5,4 @@ if(POLICY CMP0091)
+ cmake_policy(SET CMP0091 NEW)
+ endif()
+
+-add_subdirectory(re2 EXCLUDE_FROM_ALL)
+-add_subdirectory(double-conversion EXCLUDE_FROM_ALL)
+ add_subdirectory(sentencepiece EXCLUDE_FROM_ALL)
+-add_subdirectory(utf8proc EXCLUDE_FROM_ALL)
+diff --git a/torchtext/csrc/CMakeLists.txt b/torchtext/csrc/CMakeLists.txt
+index 5d67bba8a..7bae152e7 100644
+--- a/torchtext/csrc/CMakeLists.txt
++++ b/torchtext/csrc/CMakeLists.txt
+@@ -19,9 +19,6 @@ set(
+ LIBTORCHTEXT_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_SOURCE_DIR}/third_party/sentencepiece/src
+- $<TARGET_PROPERTY:re2,INCLUDE_DIRECTORIES>
+- $<TARGET_PROPERTY:double-conversion,INCLUDE_DIRECTORIES>
+- $<TARGET_PROPERTY:utf8proc,INCLUDE_DIRECTORIES>
+ ${TORCH_INSTALL_PREFIX}/include
+ ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include
+ )
+@@ -120,9 +117,6 @@ if (BUILD_TORCHTEXT_PYTHON_EXTENSION)
+ EXTENSION_INCLUDE_DIRS
+ ${PROJECT_SOURCE_DIR}
+ ${PROJECT_SOURCE_DIR}/third_party/sentencepiece/src
+- $<TARGET_PROPERTY:re2,INCLUDE_DIRECTORIES>
+- $<TARGET_PROPERTY:double-conversion,INCLUDE_DIRECTORIES>
+- $<TARGET_PROPERTY:utf8proc,INCLUDE_DIRECTORIES>
+ ${TORCH_INSTALL_PREFIX}/include
+ ${TORCH_INSTALL_PREFIX}/include/torch/csrc/api/include
+ )
diff --git a/python-torchtext.spec b/python-torchtext.spec
index 2a79528..b69f9b3 100644
--- a/python-torchtext.spec
+++ b/python-torchtext.spec
@@ -10,7 +10,16 @@ License: BSD 3-Clause
URL: https://github.com/pytorch/text
Source0: %{url}/archive/refs/tags/v%{version}.tar.gz#/text-%{version}.tar.gz
+Source1: sentencepiece.zip
+
+Patch0: 0001-disable-submodule.patch
+
BuildRequires: cmake
+BuildRequires: ninja-build
+BuildRequires: utf8proc-devel
+BuildRequires: re2-devel
+BuildRequires: double-conversion-devel
+
BuildRequires: python3-tqdm
BuildRequires: python3-requests
@@ -27,9 +36,10 @@ Summary: %{summary}
Models, data loaders and abstractions for language processing, powered by PyTorch
%prep
+unzip -q %{SOURCE1}
%autosetup -p1 -n text-%{pypi_version}
-
rm -rf third_party/*
+mv ../sentencepiece ./third_party/
%build
%py3_build
diff --git a/sources b/sources
index 1ea2c95..b4dccfe 100644
--- a/sources
+++ b/sources
@@ -1 +1,2 @@
+cf3187df653f05d56ef88d5e9d9e1773 sentencepiece.zip
0a932ddf29de28dd729801983bfdd361 text-0.16.2.tar.gz