From 7325468db20cd2e51396647e440bd8af6922df3e Mon Sep 17 00:00:00 2001 From: Maximilian Downey Twiss Date: Thu, 12 Sep 2024 00:36:58 +1000 Subject: [PATCH] More python cleanups (#10452) * Add unit tests for conflicting package properties * Fix the reported issues --- packages/micro.rb | 6 ++-- packages/natron.rb | 2 -- packages/py3_cfgv.rb | 1 - packages/py3_dool.rb | 1 - packages/py3_identify.rb | 1 - packages/py3_libxml2.rb | 2 -- packages/py3_mat2.rb | 1 - packages/py3_ply.rb | 1 - packages/py3_py.rb | 1 - packages/py3_pygments.rb | 2 +- packages/py3_pygobject.rb | 2 -- packages/py3_requests.rb | 1 - packages/py3_semantic_version.rb | 1 - packages/py3_smartypants.rb | 1 - packages/py3_sortedcontainers.rb | 1 - packages/py3_sphinxcontrib_applehelp.rb | 1 - packages/py3_sphinxcontrib_devhelp.rb | 1 - packages/py3_sphinxcontrib_htmlhelp.rb | 1 - packages/py3_sphinxcontrib_jsmath.rb | 1 - packages/py3_sphinxcontrib_qthelp.rb | 1 - packages/py3_sphinxcontrib_serializinghtml.rb | 1 - packages/py3_typogrify.rb | 1 - packages/py3_unsupported_python.rb | 3 +- packages/py3_urllib3.rb | 1 - tests/prop_test | 29 +++++++++++++++---- 25 files changed, 27 insertions(+), 37 deletions(-) diff --git a/packages/micro.rb b/packages/micro.rb index 843b06694..9077b223a 100644 --- a/packages/micro.rb +++ b/packages/micro.rb @@ -6,10 +6,6 @@ class Micro < Package version '2.0.13' license 'MIT' compatibility 'all' - binary_compression 'tar.zst' - - no_compile_needed - case ARCH when 'aarch64', 'armv7l' source_url 'https://github.com/zyedidia/micro/releases/download/v2.0.13/micro-2.0.13-linux-arm.tar.gz' @@ -22,6 +18,8 @@ class Micro < Package source_sha256 'a50e405d3d09d58f6b2c182429c18537a05f317dc0c3c9cb834b3271362e4781' end + no_compile_needed + def self.install system "install -Dm755 micro #{CREW_DEST_PREFIX}/bin/micro" end diff --git a/packages/natron.rb b/packages/natron.rb index d0450d64a..d06371bf3 100644 --- a/packages/natron.rb +++ b/packages/natron.rb @@ -10,8 +10,6 @@ class Natron < Package source_sha256 '7e8f2ec343f553799f34dce89aa250c410024f17e2c9ccfb5e22544db3e46bb4' binary_compression 'tpxz' - no_compile_needed - binary_sha256({ x86_64: '35b3c22b67f74d285e71f619179cf36a3a475d0df37dd7dcb104d22a318edce4' }) diff --git a/packages/py3_cfgv.rb b/packages/py3_cfgv.rb index 05b27c845..3b097dfd0 100644 --- a/packages/py3_cfgv.rb +++ b/packages/py3_cfgv.rb @@ -7,7 +7,6 @@ class Py3_cfgv < Pip license 'MIT' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_dool.rb b/packages/py3_dool.rb index 91a834fdf..5c99b187c 100644 --- a/packages/py3_dool.rb +++ b/packages/py3_dool.rb @@ -7,7 +7,6 @@ class Py3_dool < Pip license 'GPL3+' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' diff --git a/packages/py3_identify.rb b/packages/py3_identify.rb index 53b8c4600..d3a42952f 100644 --- a/packages/py3_identify.rb +++ b/packages/py3_identify.rb @@ -7,7 +7,6 @@ class Py3_identify < Pip license 'MIT' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_libxml2.rb b/packages/py3_libxml2.rb index 6003f5737..447a7fb09 100644 --- a/packages/py3_libxml2.rb +++ b/packages/py3_libxml2.rb @@ -37,6 +37,4 @@ class Py3_libxml2 < Package system "python3 setup.py install #{PY_SETUP_INSTALL_OPTIONS_NO_SVEM}" end end - - no_source_build end diff --git a/packages/py3_mat2.rb b/packages/py3_mat2.rb index d8bfd8df5..888ffdf1b 100644 --- a/packages/py3_mat2.rb +++ b/packages/py3_mat2.rb @@ -7,7 +7,6 @@ class Py3_mat2 < Pip license 'MIT' compatibility 'x86_64' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'py3_pycairo' # R depends_on 'python3' => :build diff --git a/packages/py3_ply.rb b/packages/py3_ply.rb index 26efbded5..d9f51a49b 100644 --- a/packages/py3_ply.rb +++ b/packages/py3_ply.rb @@ -7,7 +7,6 @@ class Py3_ply < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_py.rb b/packages/py3_py.rb index 9a50fc2eb..ceb75cd96 100644 --- a/packages/py3_py.rb +++ b/packages/py3_py.rb @@ -7,7 +7,6 @@ class Py3_py < Pip license 'MIT' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_pygments.rb b/packages/py3_pygments.rb index 16669acd3..39b53b09a 100644 --- a/packages/py3_pygments.rb +++ b/packages/py3_pygments.rb @@ -7,8 +7,8 @@ class Py3_pygments < Pip license 'BSD-2' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build + no_compile_needed end diff --git a/packages/py3_pygobject.rb b/packages/py3_pygobject.rb index c1e261411..b10e37848 100644 --- a/packages/py3_pygobject.rb +++ b/packages/py3_pygobject.rb @@ -30,6 +30,4 @@ class Py3_pygobject < Meson depends_on 'wayland' => :build meson_options '-Dtests=false' - - no_source_build end diff --git a/packages/py3_requests.rb b/packages/py3_requests.rb index d8017219b..0cb35f925 100644 --- a/packages/py3_requests.rb +++ b/packages/py3_requests.rb @@ -7,7 +7,6 @@ class Py3_requests < Pip license 'Apache-2.0' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'py3_chardet' depends_on 'py3_idna' diff --git a/packages/py3_semantic_version.rb b/packages/py3_semantic_version.rb index eb9c74411..4f9c491c1 100644 --- a/packages/py3_semantic_version.rb +++ b/packages/py3_semantic_version.rb @@ -7,7 +7,6 @@ class Py3_semantic_version < Pip license 'BSD-2' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_smartypants.rb b/packages/py3_smartypants.rb index 63a538d9d..53ac83720 100644 --- a/packages/py3_smartypants.rb +++ b/packages/py3_smartypants.rb @@ -7,7 +7,6 @@ class Py3_smartypants < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sortedcontainers.rb b/packages/py3_sortedcontainers.rb index 781469754..7036855bb 100644 --- a/packages/py3_sortedcontainers.rb +++ b/packages/py3_sortedcontainers.rb @@ -7,7 +7,6 @@ class Py3_sortedcontainers < Pip license 'Apache-2.0' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sphinxcontrib_applehelp.rb b/packages/py3_sphinxcontrib_applehelp.rb index 23af658a2..e91668275 100644 --- a/packages/py3_sphinxcontrib_applehelp.rb +++ b/packages/py3_sphinxcontrib_applehelp.rb @@ -7,7 +7,6 @@ class Py3_sphinxcontrib_applehelp < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sphinxcontrib_devhelp.rb b/packages/py3_sphinxcontrib_devhelp.rb index 5bb9f08d9..22044ebed 100644 --- a/packages/py3_sphinxcontrib_devhelp.rb +++ b/packages/py3_sphinxcontrib_devhelp.rb @@ -7,7 +7,6 @@ class Py3_sphinxcontrib_devhelp < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sphinxcontrib_htmlhelp.rb b/packages/py3_sphinxcontrib_htmlhelp.rb index b49251237..45157a068 100644 --- a/packages/py3_sphinxcontrib_htmlhelp.rb +++ b/packages/py3_sphinxcontrib_htmlhelp.rb @@ -7,7 +7,6 @@ class Py3_sphinxcontrib_htmlhelp < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sphinxcontrib_jsmath.rb b/packages/py3_sphinxcontrib_jsmath.rb index 19269a68a..7263df74c 100644 --- a/packages/py3_sphinxcontrib_jsmath.rb +++ b/packages/py3_sphinxcontrib_jsmath.rb @@ -7,7 +7,6 @@ class Py3_sphinxcontrib_jsmath < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sphinxcontrib_qthelp.rb b/packages/py3_sphinxcontrib_qthelp.rb index c4b8c35d5..a69e7b653 100644 --- a/packages/py3_sphinxcontrib_qthelp.rb +++ b/packages/py3_sphinxcontrib_qthelp.rb @@ -7,7 +7,6 @@ class Py3_sphinxcontrib_qthelp < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_sphinxcontrib_serializinghtml.rb b/packages/py3_sphinxcontrib_serializinghtml.rb index 7d96ffe49..fe8b26b52 100644 --- a/packages/py3_sphinxcontrib_serializinghtml.rb +++ b/packages/py3_sphinxcontrib_serializinghtml.rb @@ -7,7 +7,6 @@ class Py3_sphinxcontrib_serializinghtml < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_typogrify.rb b/packages/py3_typogrify.rb index 9afb0fab2..9716381fd 100644 --- a/packages/py3_typogrify.rb +++ b/packages/py3_typogrify.rb @@ -7,7 +7,6 @@ class Py3_typogrify < Pip license 'BSD' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_unsupported_python.rb b/packages/py3_unsupported_python.rb index fbabad862..7bb1bedfe 100644 --- a/packages/py3_unsupported_python.rb +++ b/packages/py3_unsupported_python.rb @@ -1,13 +1,12 @@ require 'buildsystems/pip' class Py3_unsupported_python < Pip - version '1.0.0-py3.12' + description 'This package can be used as a conditional dependency to indicate lack of support for particular versions of Python.' homepage 'https://github.com/ntessore/unsupported-python' version '1.0.0-py3.12' license 'GPL-3+' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/packages/py3_urllib3.rb b/packages/py3_urllib3.rb index db48bb5f6..66da9b33b 100644 --- a/packages/py3_urllib3.rb +++ b/packages/py3_urllib3.rb @@ -7,7 +7,6 @@ class Py3_urllib3 < Pip license 'MIT' compatibility 'all' source_url 'SKIP' - binary_compression 'tar.zst' depends_on 'python3' => :build diff --git a/tests/prop_test b/tests/prop_test index 7ef020d02..0cd67e035 100755 --- a/tests/prop_test +++ b/tests/prop_test @@ -9,12 +9,29 @@ $LOAD_PATH.unshift File.join(CREW_LIB_PATH, 'lib') def check_properties(name) puts "Checking #{name} package ...".yellow - puts "#{name} is missing a description.".lightred if @pkg.description.to_s.empty? - puts "#{name} is missing a homepage.".lightred if @pkg.homepage.to_s.empty? - puts "#{name} is missing a version.".lightred if @pkg.version.to_s.empty? - puts "#{name} is missing a license.".lightred if @pkg.license.to_s.empty? - puts "#{name} is missing a compatibility.".lightred if @pkg.compatibility.to_s.empty? - if @pkg.description.to_s.empty? || @pkg.homepage.to_s.empty? || @pkg.version.to_s.empty? || @pkg.license.to_s.empty? || @pkg.compatibility.to_s.empty? + # List out all the possible failure states + empty_description = @pkg.description.to_s.empty? + empty_homepage = @pkg.homepage.to_s.empty? + empty_version = @pkg.version.to_s.empty? + empty_license = @pkg.license.to_s.empty? + empty_compatibility = @pkg.compatibility.to_s.empty? + # Certain fake packages set up to act as aliases (we should probably move on from these) do not have source_url values. + empty_source_url = @pkg.source_url.to_s.empty? && !@pkg.is_fake? + both_binary_compression_and_no_compile_needed = @pkg.no_compile_needed? && !@pkg.binary_compression.to_s.empty? + non_skip_source_url_and_no_source_build = @pkg.no_source_build? && !@pkg.source_url.eql?('SKIP') + + # Tell the user what specific test fiailed. + puts "#{name} is missing a description.".lightred if empty_description + puts "#{name} is missing a homepage.".lightred if empty_homepage + puts "#{name} is missing a version.".lightred if empty_version + puts "#{name} is missing a license.".lightred if empty_license + puts "#{name} is missing a compatibility.".lightred if empty_compatibility + puts "#{name} is missing a source_url.".lightred if empty_source_url + puts "#{name} has a binary_compression value and a no_compile_needed value." if both_binary_compression_and_no_compile_needed + puts "#{name} has a non-SKIP source_url and a no_source_build value." if non_skip_source_url_and_no_source_build + + # Check that if the tests passed. + if empty_description || empty_homepage || empty_version || empty_license || empty_compatibility || empty_source_url || both_binary_compression_and_no_compile_needed || non_skip_source_url_and_no_source_build puts "Property tests for #{name} failed.".lightred @tofail += 1 else