f38
Mattias Ellert 2 years ago
parent 0b253b2075
commit fd7fcb17c8

6
.gitignore vendored

@ -1,5 +1 @@
/Inline-Python-0.49.tar.gz
/Inline-Python-0.50.tar.gz
/Inline-Python-0.52.tar.gz
/Inline-Python-0.54.tar.gz
/Inline-Python-0.56.tar.gz
/*.tar.gz

@ -0,0 +1,62 @@
From 9edd5893d574e3b6778723714787fd5f3dd09524 Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Tue, 18 Oct 2022 19:07:29 +0200
Subject: [PATCH] Fix Makefile logic
- shared_lib_priority() checks that the shared library exist in LIBPL.
No need to do the same check again when shared_lib_priority() is true.
- check_static_library() should check that the static library exists.
- Add LIBPL, but not LIBDIR, to RPATH.
---
Makefile.PL | 18 ++++++++++--------
1 file changed, 10 insertions(+), 8 deletions(-)
diff --git a/Makefile.PL b/Makefile.PL
index 7d1a1b4..407451c 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -310,12 +310,6 @@ sub special_non_windows_check_shared_static_libs {
if (shared_lib_priority($ref)) {
$ref->{libpython} = $ref->{ldlib};
- my $shared_lib = File::Spec->catfile($ref->{libpath}, $ref->{libpython});
- if (!-f $shared_lib) {
- # Special case for pyenv. The shared library exists in $LIBDIR instead of in
- # $LIBPL
- $ref->{libpath} = get_config_var($ref, "LIBDIR");
- }
$ref->{rpath} = $ref->{libpath};
}
else {
@@ -340,9 +334,14 @@ sub special_non_windows_check_shared_static_libs {
. "WARNING: This is known to not work on linux.\n";
}
}
- $ref->{libpath} = get_config_var($ref, "LIBDIR");
$ref->{libpython} = $ref->{ldlib};
- $ref->{rpath} = $ref->{libpath};
+ my $shared_lib = File::Spec->catfile($ref->{libpath}, $ref->{libpython});
+ if (!-f $shared_lib) {
+ $ref->{libpath} = get_config_var($ref, "LIBDIR");
+ }
+ else {
+ $ref->{rpath} = $ref->{libpath};
+ }
}
}
}
@@ -363,6 +362,9 @@ sub shared_lib_priority {
sub check_static_library_ok {
my ($ref) = @_;
+ my $static_lib = File::Spec->catfile($ref->{libpath}, $ref->{libpython});
+ return 0 if (!-f $static_lib);
+
# We should check if the static library was compiled with -fPIC, or else
# we cannot create a shared Python.so from it.
# TODO: It seem like it is possible to build python with --enable-shared
--
2.37.3

@ -1,47 +0,0 @@
From 90b68bdf370c07b1d3fdd46bbdf1b154ed74b91b Mon Sep 17 00:00:00 2001
From: Mattias Ellert <mattias.ellert@physics.uu.se>
Date: Wed, 18 Aug 2021 16:41:10 +0200
Subject: [PATCH] Call Py_Initialize() before calling PyBytes_FromString()
Not doing this gives a segmentation fault with Python 3.10
---
Python.xs | 16 ++++++++--------
1 file changed, 8 insertions(+), 8 deletions(-)
diff --git a/Python.xs b/Python.xs
index 11d5033..7a3c793 100644
--- a/Python.xs
+++ b/Python.xs
@@ -25,14 +25,6 @@ void do_pyinit() {
#ifdef EXPOSE_PERL
PyObject *main_dict;
PyObject *perl_obj;
-
-#if PY_MAJOR_VERSION >= 3
- PyObject *dummy1 = PyBytes_FromString(""),
- *dummy2 = PyBytes_FromString("main");
-#else
- PyObject *dummy1 = PyString_FromString(""),
- *dummy2 = PyString_FromString("main");
-#endif
#endif
/* sometimes Python needs to know about argc and argv to be happy */
int _python_argc = 1;
@@ -48,6 +40,14 @@ void do_pyinit() {
PySys_SetArgv(_python_argc, _python_argv); /* Tk needs this */
#ifdef EXPOSE_PERL
+#if PY_MAJOR_VERSION >= 3
+ PyObject *dummy1 = PyBytes_FromString(""),
+ *dummy2 = PyBytes_FromString("main");
+#else
+ PyObject *dummy1 = PyString_FromString(""),
+ *dummy2 = PyString_FromString("main");
+#endif
+
/* create the perl module and add functions */
initperl();
--
2.31.1

@ -1,14 +1,13 @@
Name: perl-Inline-Python
Version: 0.56
Release: 23%{?dist}
Version: 0.57
Release: 1%{?dist}
Summary: Write Perl subs and classes in Python
License: GPL+ or Artistic
URL: https://metacpan.org/release/Inline-Python
Source0: https://cpan.metacpan.org/authors/id/N/NI/NINE/Inline-Python-%{version}.tar.gz
# Call Py_Initialize() before calling PyBytes_FromString()
# Fixes segmentation fault with python 3.10
# https://github.com/niner/inline-python-pm/pull/33
Patch0: %{name}-pyinit.patch
# Fix makefile logic
# https://github.com/niner/inline-python-pm/pull/38
Patch0: %{name}-makefile.patch
BuildRequires: gcc
BuildRequires: findutils
BuildRequires: make
@ -62,7 +61,7 @@ name-space is cached, and subsequent calls use the cached version.
%patch0 -p1
%build
INLINE_PYTHON_EXECUTABLE=/usr/bin/python3 %{__perl} Makefile.PL INSTALLDIRS=vendor OPTIMIZE="$RPM_OPT_FLAGS" NO_PACKLIST=1
INLINE_PYTHON_EXECUTABLE=/usr/bin/python3 %{__perl} Makefile.PL INSTALLDIRS=vendor NO_PACKLIST=1
make %{?_smp_mflags}
%install
@ -82,6 +81,9 @@ make test
%{_mandir}/man3/*
%changelog
* Mon Oct 17 2022 Mattias Ellert <mattias.ellert@physics.uu.se> - 0.57-1
- 0.57 bump
* Fri Jul 22 2022 Fedora Release Engineering <releng@fedoraproject.org> - 0.56-23
- Rebuilt for https://fedoraproject.org/wiki/Fedora_37_Mass_Rebuild
@ -181,7 +183,9 @@ make test
* Wed Jun 24 2015 Jon Kerr Nilsen <j.k.nilsen@usit.uio.no> 0.49-3
- added two forgotten BuildRequires
* Wed Jun 24 2015 Jon Kerr Nilsen <j.k.nilsen@usit.uio.no> 0.49-2
- adjusted to fit Fedora packaging guidelines.
* Fri Jun 19 2015 Jon Kerr Nilsen <j.k.nilsen@usit.uio.no> 0.49-1
- Specfile autogenerated by cpanspec 1.78.

@ -1 +1 @@
SHA512 (Inline-Python-0.56.tar.gz) = d5fffec8a377ec10c8b21ed9324e2de5a77d10304fc2a89196df89984e55869e3e4e0ef970f1aa4651068b8a6d834fa8eb18d70a052c646ddd98ef338f772e7d
SHA512 (Inline-Python-0.57.tar.gz) = 1cf32e8fb746b0b2420eb732178ac6e5e6813501534a159c6865b1a8a6e402eed0a4769d6a85c6639e628e4dea0c2b3d9e99bb291506d343267118b2f148e9b9

Loading…
Cancel
Save