# Created by pyp2rpm-3.2.1 %global srcname jieba %global sum Chinese Words Segementation Utilities %global desc Python Chinese word segmentation module %global commit 4eef868338d1938d5d2410992e2dcd0f2670bea6 Name: python-%{srcname} Version: 0.38 Release: 1%{?dist} Summary: %{sum} License: MIT URL: https://github.com/fxsjy/%{srcname} Source0: https://github.com/fxsjy/jieba/archive/%{commit}.tar.gz #This is a temporary work around of the missing 0.38 branch on github and the missing license and documentation on pypi repository. BuildArch: noarch BuildRequires: python2-devel BuildRequires: python-setuptools BuildRequires: python2-whoosh BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-whoosh #Whoosh imported in file jieba/analyse/analyzer.py %description %{desc} %package -n python2-%{srcname} Summary: %{sum} Requires: python2-whoosh %description -n python2-%{srcname} %{desc} %package -n python3-%{srcname} Summary: %{sum} Requires: python3-whoosh %description -n python3-%{srcname} %{desc} %prep %autosetup -n %{srcname}-%{commit} sed -i -e '\@#!/usr/bin/env python@, 1d' 'jieba/analyse/textrank.py' #Fix rpmlint wrong-script-interpreter complaint (the modulus still function without the fix) %build %py2_build %py3_build %install %py2_install %py3_install %check #Tests did'n run properly using Python2, because of encoding issues. export PYTHONPATH=$(PYTHONPATH):$RPM_BUILD_ROOT%{python3_sitelib} cd test for f in extract_tags_idfpath.py extract_tags.py extract_tags_stop_words.py extract_tags_with_weight.py test_file.py test_pos_file.py test_whoosh_file.py test_whoosh_file_read.py; do python3 $f foobar.txt; done for f in demo.py jieba_test.py test_bug.py test_change_dictpath.py test_cutall.py test_cut_for_search.py test_lock.py test_multithread.py test_no_hmm.py test_pos_no_hmm.py test_pos.py test.py test_tokenize_no_hmm.py test_tokenize.py test_userdict.py test_whoosh.py; do python3 $f; done cd parallel for f in test2.py test_cut_for_search.py test_disable_hmm.py test_pos.py test.py; do python3 $f; done for f in extract_tags.py test_file.py test_pos_file.py; do python3 $f ../foobar.txt; done # Test not run: extract_topic.py require extra dependency python-scikit-learn %files -n python2-%{srcname} %license LICENSE %doc README.md %{python2_sitelib}/%{srcname} %{python2_sitelib}/%{srcname}-%{version}-py?.?.egg-info %files -n python3-%{srcname} %license LICENSE %doc README.md %{python3_sitelib}/%{srcname} %{python3_sitelib}/%{srcname}-%{version}-py?.?.egg-info %changelog * Sat Aug 05 2017 yecheng <18969068329@163.com> - 0.38-1 - Initial package.