%global _empty_manifest_terminate_build 0 Name: python-mutf8 Version: 1.0.6 Release: 1 Summary: Fast MUTF-8 encoder & decoder License: MIT License URL: http://github.com/TkTech/mutf8 Source0: https://mirrors.aliyun.com/pypi/web/packages/ca/31/3c57313757b3a47dcf32d2a9bad55d913b797efc8814db31bed8a7142396/mutf8-1.0.6.tar.gz %description ![Tests](https://github.com/TkTech/mutf8/workflows/Tests/badge.svg?branch=master) # mutf-8 This package contains simple pure-python as well as C encoders and decoders for the MUTF-8 character encoding. In most cases, you can also parse the even-rarer CESU-8. These days, you'll most likely encounter MUTF-8 when working on files or protocols related to the JVM. Strings in a Java `.class` file are encoded using MUTF-8, strings passed by the JNI, as well as strings exported by the object serializer. This library was extracted from [Lawu][], a Python library for working with JVM class files. ## 🎉 Installation Install the package from PyPi: ``` pip install mutf8 ``` Binary wheels are available for the following: | | py3.6 | py3.7 | py3.8 | py3.9 | | ---------------- | ----- | ----- | ----- | ----- | | OS X (x86_64) | y | y | y | y | | Windows (x86_64) | y | y | y | y | | Linux (x86_64) | y | y | y | y | If binary wheels are not available, it will attempt to build the C extension from source with any C99 compiler. If it could not build, it will fall back to a pure-python version. ## Usage Encoding and decoding is simple: ```python from mutf8 import encode_modified_utf8, decode_modified_utf8 unicode = decode_modified_utf8(byte_like_object) bytes = encode_modified_utf8(unicode) ``` This module *does not* register itself globally as a codec, since importing should be side-effect-free. ## 📈 Benchmarks The C extension is significantly faster - often 20x to 40x faster. ### MUTF-8 Decoding | Name | Min (μs) | Max (μs) | StdDev | Ops | |------------------------------|------------|------------|----------|---------------| | cmutf8-decode_modified_utf8 | 0.00009 | 0.00080 | 0.00000 | 9957678.56358 | | pymutf8-decode_modified_utf8 | 0.00190 | 0.06040 | 0.00000 | 450455.96019 | ### MUTF-8 Encoding | Name | Min (μs) | Max (μs) | StdDev | Ops | |------------------------------|------------|------------|----------|----------------| | cmutf8-encode_modified_utf8 | 0.00008 | 0.00151 | 0.00000 | 11897361.05101 | | pymutf8-encode_modified_utf8 | 0.00180 | 0.16650 | 0.00000 | 474390.98091 | ## C Extension The C extension is optional. If a binary package is not available, or a C compiler is not present, the pure-python version will be used instead. If you want to ensure you're using the C version, import it directly: ```python from mutf8.cmutf8 import decode_modified_utf8 decode_modified_utf(b'\xED\xA1\x80\xED\xB0\x80') ``` [Lawu]: https://github.com/tktech/lawu %package -n python3-mutf8 Summary: Fast MUTF-8 encoder & decoder Provides: python-mutf8 BuildRequires: python3-devel BuildRequires: python3-setuptools BuildRequires: python3-pip BuildRequires: python3-cffi BuildRequires: gcc BuildRequires: gdb %description -n python3-mutf8 ![Tests](https://github.com/TkTech/mutf8/workflows/Tests/badge.svg?branch=master) # mutf-8 This package contains simple pure-python as well as C encoders and decoders for the MUTF-8 character encoding. In most cases, you can also parse the even-rarer CESU-8. These days, you'll most likely encounter MUTF-8 when working on files or protocols related to the JVM. Strings in a Java `.class` file are encoded using MUTF-8, strings passed by the JNI, as well as strings exported by the object serializer. This library was extracted from [Lawu][], a Python library for working with JVM class files. ## 🎉 Installation Install the package from PyPi: ``` pip install mutf8 ``` Binary wheels are available for the following: | | py3.6 | py3.7 | py3.8 | py3.9 | | ---------------- | ----- | ----- | ----- | ----- | | OS X (x86_64) | y | y | y | y | | Windows (x86_64) | y | y | y | y | | Linux (x86_64) | y | y | y | y | If binary wheels are not available, it will attempt to build the C extension from source with any C99 compiler. If it could not build, it will fall back to a pure-python version. ## Usage Encoding and decoding is simple: ```python from mutf8 import encode_modified_utf8, decode_modified_utf8 unicode = decode_modified_utf8(byte_like_object) bytes = encode_modified_utf8(unicode) ``` This module *does not* register itself globally as a codec, since importing should be side-effect-free. ## 📈 Benchmarks The C extension is significantly faster - often 20x to 40x faster. ### MUTF-8 Decoding | Name | Min (μs) | Max (μs) | StdDev | Ops | |------------------------------|------------|------------|----------|---------------| | cmutf8-decode_modified_utf8 | 0.00009 | 0.00080 | 0.00000 | 9957678.56358 | | pymutf8-decode_modified_utf8 | 0.00190 | 0.06040 | 0.00000 | 450455.96019 | ### MUTF-8 Encoding | Name | Min (μs) | Max (μs) | StdDev | Ops | |------------------------------|------------|------------|----------|----------------| | cmutf8-encode_modified_utf8 | 0.00008 | 0.00151 | 0.00000 | 11897361.05101 | | pymutf8-encode_modified_utf8 | 0.00180 | 0.16650 | 0.00000 | 474390.98091 | ## C Extension The C extension is optional. If a binary package is not available, or a C compiler is not present, the pure-python version will be used instead. If you want to ensure you're using the C version, import it directly: ```python from mutf8.cmutf8 import decode_modified_utf8 decode_modified_utf(b'\xED\xA1\x80\xED\xB0\x80') ``` [Lawu]: https://github.com/tktech/lawu %package help Summary: Development documents and examples for mutf8 Provides: python3-mutf8-doc %description help ![Tests](https://github.com/TkTech/mutf8/workflows/Tests/badge.svg?branch=master) # mutf-8 This package contains simple pure-python as well as C encoders and decoders for the MUTF-8 character encoding. In most cases, you can also parse the even-rarer CESU-8. These days, you'll most likely encounter MUTF-8 when working on files or protocols related to the JVM. Strings in a Java `.class` file are encoded using MUTF-8, strings passed by the JNI, as well as strings exported by the object serializer. This library was extracted from [Lawu][], a Python library for working with JVM class files. ## 🎉 Installation Install the package from PyPi: ``` pip install mutf8 ``` Binary wheels are available for the following: | | py3.6 | py3.7 | py3.8 | py3.9 | | ---------------- | ----- | ----- | ----- | ----- | | OS X (x86_64) | y | y | y | y | | Windows (x86_64) | y | y | y | y | | Linux (x86_64) | y | y | y | y | If binary wheels are not available, it will attempt to build the C extension from source with any C99 compiler. If it could not build, it will fall back to a pure-python version. ## Usage Encoding and decoding is simple: ```python from mutf8 import encode_modified_utf8, decode_modified_utf8 unicode = decode_modified_utf8(byte_like_object) bytes = encode_modified_utf8(unicode) ``` This module *does not* register itself globally as a codec, since importing should be side-effect-free. ## 📈 Benchmarks The C extension is significantly faster - often 20x to 40x faster. ### MUTF-8 Decoding | Name | Min (μs) | Max (μs) | StdDev | Ops | |------------------------------|------------|------------|----------|---------------| | cmutf8-decode_modified_utf8 | 0.00009 | 0.00080 | 0.00000 | 9957678.56358 | | pymutf8-decode_modified_utf8 | 0.00190 | 0.06040 | 0.00000 | 450455.96019 | ### MUTF-8 Encoding | Name | Min (μs) | Max (μs) | StdDev | Ops | |------------------------------|------------|------------|----------|----------------| | cmutf8-encode_modified_utf8 | 0.00008 | 0.00151 | 0.00000 | 11897361.05101 | | pymutf8-encode_modified_utf8 | 0.00180 | 0.16650 | 0.00000 | 474390.98091 | ## C Extension The C extension is optional. If a binary package is not available, or a C compiler is not present, the pure-python version will be used instead. If you want to ensure you're using the C version, import it directly: ```python from mutf8.cmutf8 import decode_modified_utf8 decode_modified_utf(b'\xED\xA1\x80\xED\xB0\x80') ``` [Lawu]: https://github.com/tktech/lawu %prep %autosetup -n mutf8-1.0.6 %build %py3_build %install %py3_install install -d -m755 %{buildroot}/%{_pkgdocdir} if [ -d doc ]; then cp -arf doc %{buildroot}/%{_pkgdocdir}; fi if [ -d docs ]; then cp -arf docs %{buildroot}/%{_pkgdocdir}; fi if [ -d example ]; then cp -arf example %{buildroot}/%{_pkgdocdir}; fi if [ -d examples ]; then cp -arf examples %{buildroot}/%{_pkgdocdir}; fi pushd %{buildroot} if [ -d usr/lib ]; then find usr/lib -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/lib64 ]; then find usr/lib64 -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/bin ]; then find usr/bin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi if [ -d usr/sbin ]; then find usr/sbin -type f -printf "\"/%h/%f\"\n" >> filelist.lst fi touch doclist.lst if [ -d usr/share/man ]; then find usr/share/man -type f -printf "\"/%h/%f.gz\"\n" >> doclist.lst fi popd mv %{buildroot}/filelist.lst . mv %{buildroot}/doclist.lst . %files -n python3-mutf8 -f filelist.lst %dir %{python3_sitearch}/* %files help -f doclist.lst %{_docdir}/* %changelog * Thu Jun 08 2023 Python_Bot - 1.0.6-1 - Package Spec generated