roy-ht / editdistance

Fast implementation of the edit distance(Levenshtein distance)
MIT License
659 stars 61 forks source link

0.8.1: pep517 based build packages some files which should not be packaged and compile time warnings #112

Open kloczek opened 7 months ago

kloczek commented 7 months ago

Looks like .cpp, .h, .pyx and even .gitignore are packaged.

build output ```console + /usr/bin/python3 -sBm build -w --no-isolation * Getting build dependencies for wheel... * Building wheel... running build running build_py creating /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38 creating /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance copying src/editdistance/__init__.py -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance running egg_info creating src/editdistance.egg-info writing src/editdistance.egg-info/PKG-INFO writing dependency_links to src/editdistance.egg-info/dependency_links.txt writing top-level names to src/editdistance.egg-info/top_level.txt writing manifest file 'src/editdistance.egg-info/SOURCES.txt' reading manifest file 'src/editdistance.egg-info/SOURCES.txt' adding license file 'LICENSE' writing manifest file 'src/editdistance.egg-info/SOURCES.txt' copying src/editdistance/__init__.pxd -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/_editdistance.cpp -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/_editdistance.h -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/bycython.cpp -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/bycython.pxd -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/bycython.pyx -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/def.h -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance <<<=== HERE copying src/editdistance/__init__.py -> /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance running build_ext building 'editdistance.bycython' extension creating /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38 creating /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38/src creating /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38/src/editdistance /usr/bin/gcc -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -Isrc/editdistance -I/usr/include/python3.8 -c src/editdistance/_editdistance.cpp -o /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38/src/editdistance/_editdistance.o In member function ‘varr<1ul>::operator[](unsigned long const&)’, inlined from ‘edit_distance_bpv, std::less, std::allocator > > >, varr<1ul> >(std::map, std::less, std::allocator > > >&, long const*, unsigned long const&, unsigned int const&, unsigned int const&)unsigned int’ at src/editdistance/_editdistance.cpp:52:15, inlined from ‘edit_distance_map_<1ul>(long const*, unsigned long, long const*, unsigned long)unsigned int’ at src/editdistance/_editdistance.cpp:120:67: src/editdistance/_editdistance.cpp:105:20: warning: array subscript 1 is above array bounds of ‘uint64_t[1]’ [-Warray-bounds=] 105 | return arr_[i]; | ~~~~^ src/editdistance/_editdistance.cpp: In function ‘edit_distance_map_<1ul>(long const*, unsigned long, long const*, unsigned long)unsigned int’: src/editdistance/_editdistance.cpp:103:14: note: while referencing ‘arr_’ 103 | uint64_t arr_[N]; | ^~~~ In member function ‘varr<1ul>::operator[](unsigned long const&)’, inlined from ‘edit_distance_bpv, std::less, std::allocator > > >, varr<1ul> >(std::map, std::less, std::allocator > > >&, long const*, unsigned long const&, unsigned int const&, unsigned int const&)unsigned int’ at src/editdistance/_editdistance.cpp:52:15, inlined from ‘edit_distance_map_<1ul>(long const*, unsigned long, long const*, unsigned long)unsigned int’ at src/editdistance/_editdistance.cpp:120:67: src/editdistance/_editdistance.cpp:105:20: warning: array subscript 1 is above array bounds of ‘uint64_t[1]’ [-Warray-bounds=] 105 | return arr_[i]; | ~~~~^ src/editdistance/_editdistance.cpp: In function ‘edit_distance_map_<1ul>(long const*, unsigned long, long const*, unsigned long)unsigned int’: src/editdistance/_editdistance.cpp:103:14: note: while referencing ‘arr_’ 103 | uint64_t arr_[N]; | ^~~~ In member function ‘varr<1ul>::operator[](unsigned long const&)’, inlined from ‘edit_distance_bpv, std::less, std::allocator > > >, varr<1ul> >(std::map, std::less, std::allocator > > >&, long const*, unsigned long const&, unsigned int const&, unsigned int const&)unsigned int’ at src/editdistance/_editdistance.cpp:53:46, inlined from ‘edit_distance_map_<1ul>(long const*, unsigned long, long const*, unsigned long)unsigned int’ at src/editdistance/_editdistance.cpp:120:67: src/editdistance/_editdistance.cpp:105:20: warning: array subscript 1 is above array bounds of ‘uint64_t[1]’ [-Warray-bounds=] 105 | return arr_[i]; | ~~~~^ src/editdistance/_editdistance.cpp: In function ‘edit_distance_map_<1ul>(long const*, unsigned long, long const*, unsigned long)unsigned int’: src/editdistance/_editdistance.cpp:103:14: note: while referencing ‘arr_’ 103 | uint64_t arr_[N]; | ^~~~ /usr/bin/gcc -DDYNAMIC_ANNOTATIONS_ENABLED=1 -DNDEBUG -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -D_GNU_SOURCE -fPIC -fwrapv -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -O2 -g -grecord-gcc-switches -pipe -Wall -Werror=format-security -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -fdata-sections -ffunction-sections -flto=auto -flto-partition=none -D_GNU_SOURCE -fPIC -fwrapv -ffat-lto-objects -fno-semantic-interposition -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security -fPIC -Isrc/editdistance -I/usr/include/python3.8 -c src/editdistance/bycython.cpp -o /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38/src/editdistance/bycython.o src/editdistance/bycython.cpp: In function ‘unsigned int __pyx_f_12editdistance_8bycython_eval(PyObject*, PyObject*, int)’: src/editdistance/bycython.cpp:2383:13: warning: conversion from ‘long unsigned int’ to ‘unsigned int’ changes value from ‘18446744073709551615’ to ‘4294967295’ [-Woverflow] 2383 | __pyx_r = 0xffffffffffffffff; | ^~~~~~~~~~~~~~~~~~ /usr/bin/g++ -shared -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--as-needed -flto=auto -flto-partition=none -fuse-linker-plugin -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,--build-id=sha1 -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -Wl,--gc-sections -Wl,--as-needed -Wl,--build-id=sha1 -Wl,-z,now -specs=/usr/lib/rpm/redhat/redhat-hardened-ld -Wl,-z,pack-relative-relocs -flto=auto -fuse-linker-plugin -m64 -mtune=generic -fasynchronous-unwind-tables -fstack-clash-protection -fcf-protection -O2 -g -grecord-gcc-switches -pipe -specs=/usr/lib/rpm/redhat/redhat-annobin-cc1 -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -fdata-sections -ffunction-sections -fstack-protector-strong -specs=/usr/lib/rpm/redhat/redhat-hardened-cc1 -flto=auto -Wp,-U_FORTIFY_SOURCE,-D_FORTIFY_SOURCE=3 -Wp,-D_GLIBCXX_ASSERTIONS -Wall -Werror=format-security /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38/src/editdistance/_editdistance.o /tmp/pdm-build-dj8et6ut/temp.linux-x86_64-cpython-38/src/editdistance/bycython.o -L/usr/lib64 -o /tmp/pdm-build-dj8et6ut/lib.linux-x86_64-cpython-38/editdistance/bycython.cpython-38-x86_64-linux-gnu.so - Adding .pdm-build/.gitignore -> .gitignore <<<=== HERE - Adding .pdm-build/editdistance-0.8.1.dist-info/METADATA -> editdistance-0.8.1.dist-info/METADATA - Adding .pdm-build/editdistance-0.8.1.dist-info/WHEEL -> editdistance-0.8.1.dist-info/WHEEL - Adding .pdm-build/editdistance-0.8.1.dist-info/licenses/LICENSE -> editdistance-0.8.1.dist-info/licenses/LICENSE - Adding .pdm-build/editdistance/__init__.pxd -> editdistance/__init__.pxd - Adding .pdm-build/editdistance/__init__.py -> editdistance/__init__.py - Adding .pdm-build/editdistance/_editdistance.cpp -> editdistance/_editdistance.cpp - Adding .pdm-build/editdistance/_editdistance.h -> editdistance/_editdistance.h - Adding .pdm-build/editdistance/bycython.cpp -> editdistance/bycython.cpp - Adding .pdm-build/editdistance/bycython.cpython-38-x86_64-linux-gnu.so -> editdistance/bycython.cpython-38-x86_64-linux-gnu.so - Adding .pdm-build/editdistance/bycython.pxd -> editdistance/bycython.pxd - Adding .pdm-build/editdistance/bycython.pyx -> editdistance/bycython.pyx - Adding .pdm-build/editdistance/def.h -> editdistance/def.h - Adding editdistance-0.8.1.dist-info/RECORD -> editdistance-0.8.1.dist-info/RECORD Successfully built editdistance-0.8.1-cp38-cp38-linux_x86_64.whl ```

In above output is possible to find compile time warnings as well.

musicinmybrain commented 7 months ago

I noticed this while trying to update the Fedora package.

I couldn’t find any documentation on how to control this with the PDM build backend, so I worked around it downstream rather than offering a PR to fix it properly.

kloczek commented 7 months ago

IIRC exclude/include placed in pyproject.toml should be honored as well as it is defined IIRC by some PEP. If not I'm not sure but maybe use MANIFEST.in file works with `pdm-backed' as well. 🤔