python-2.7.16 (working "ish")

hammy

Active member
Jun 1, 2019
108
68
28
UK
Most tests passing, still some issues with long doubles, some ctypes calls (which might be locale related) - which can be recreated with make test.

Patch here: https://raw.githubusercontent.com/danielhams/didbs/master/packages/python2/python2_7_16.sgifixes.patch

Depends on: openssl, berkley-db, ncurses, probably other things if it can find them

Example environment:
Code:
CPPFLAGS="-D_SGI_SOURCE -D_SGI_REENTRANT_FUNCTIONS -I/builds/dan/bootstrapinstall/include -I/builds/dan/bootstrapinstall/include/ncurses"
CC=c99
CXX=CC
CFLAGS="-mips4"
CXXFLAGS="$CFLAGS"
LDFLAGS="-mips4 -L/builds/dan/bootstrapinstall/lib"
This one was a fun one - I have to "autoreconf" after applying the patch, and binutils ld/as need to be in the PATH for the build to complete.
 
Last edited:
  • Like
Reactions: Elf

Elf

Storybook / Retired, ex-staff
Feb 4, 2019
792
252
63
Mountain West (US)
I've made a post about my ventures in compiling Python 2.7.16 with MIPSPro cc on irix.net
Great work! :)

By the way, any effort to reproduce the text here would be appreciated. Some of the most prolific developers are banned on IRIX Network and others consciously choose not to participate there as well. Don't mean to be a wet blanket since this is a great achievement, but unfortunately that's just the state of things. :(
 
Last edited:

Elf

Storybook / Retired, ex-staff
Feb 4, 2019
792
252
63
Mountain West (US)
Just as a heads up, I moved the non-Python posts to SGUG history Q&A. I don't want to derail the discussion from Python or Dexter's work, and I also apologize for my part in prompting that.
 

dexter1

New member
Jul 26, 2019
12
11
3
Zoetermeer, the Netherlands
Thanks Elf, i've reposted my Python topic from IN to here, but i needed to shorten it. My post seems to be too long for the forum system, so i've split the post in three parts.

This is a post about how i managed to compile python 2.7.16 with MIPSPro 7.4.4. on my IRIX 6.5.22m O2.
My objective was to minimize the amount of failed unittests, and for the ones that do fail, understand why they fail.

Since Python 2.7 has reached the end of life as of 01-01-2020 there will be a final 2.7 release before april 2020 with version number 2.7.18, so instead of going to 2.7.17 i release fixes to 2.7.16 for now and update to 2.7.18 later this year, so that we don't need to wait for further versions and have an 'ultimate' version ready, which saves me from doing a lot of work.

I started out with the Nekoware python patches and build instructions from Rainer Canavan. He creaed an excellent patch file as well as including IndigoMagic icons for the Python program and scripts.
I then included patches from Daniel Hams at https://github.com/danielhams/didbs/blob/master/packages/python2/python2_7_16.sgifixes.patch and at https://github.com/danielhams/didbs/blob/master/packages/python2/python2.sgifixes.patch

The patch that i have extended from Rainer's and Daniel's patch files is big and fixes, among other things, shared library creation, ABI settings, semaphore handling and a few bugs in separate modules. I've started running the test suite and noted down each failed test, find the module which causes it and try to fix it.

This fixes the building of a shared libpython.so library:

--- ./Makefile.pre.in Thu Sep 12 21:18:17 2019
+++ ./Makefile.pre.in Fri Sep 13 18:34:55 2019
@@ -541,8 +541,8 @@

libpython$(VERSION).so: $(LIBRARY_OBJS)
if test $(INSTSONAME) != $(LDLIBRARY); then \
- $(BLDSHARED) -Wl,-h$(INSTSONAME) -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
- $(LN) -f $(INSTSONAME) $@; \
+ $(BLDSHARED) -soname $(INSTSONAME) -set_version sgi1.0 -o $(INSTSONAME) $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
+ $(LN) -sf $(INSTSONAME) $@; \
else \
$(BLDSHARED) -o $@ $(LIBRARY_OBJS) $(MODLIBS) $(SHLIBS) $(LIBC) $(LIBM) $(LDLAST); \
fi
--- ./configure Thu Sep 12 13:08:47 2019
+++ ./configure Sat Sep 14 15:30:37 2019
@@ -5492,6 +5492,12 @@
esac
INSTSONAME="$LDLIBRARY".$SOVERSION
;;
+ IRIX*)
+ LDLIBRARY='libpython$(VERSION).so'
+ BLDLIBRARY='-Wl,-rpath -Wl,$(LIBDIR) -L. -lpython$(VERSION)'
+ RUNSHARED=LD_LIBRARYN32_PATH=`pwd`${LD_LIBRARYN32_PATH:+:${LD_LIBRARYN32_PATH}}
+ INSTSONAME="$LDLIBRARY".$SOVERSION
+ ;;
hp*|HP*)
case `uname -m` in
ia64)
@@ -8747,10 +8753,11 @@
then CCSHARED="-fPIC"
else CCSHARED="-Kpic -belf"
fi;;
- IRIX*/6*) case $CC in
- *gcc*) CCSHARED="-shared";;
- *) CCSHARED="";;
- esac;;
+ IRIX*/6*)
+ if test "$GCC" = "yes"
+ then CCSHARED="-fPIC"
+ else CCSHARED="-KPIC"
+ fi;;
atheos*) CCSHARED="-fPIC";;
esac
fi


This fixes the ABI to n32, enters some sensible commands for shared library creation and preprocessors and sets the target to IRIX regardless of IRIX or IRIX64 platforms.

--- ./configure Thu Sep 12 13:08:47 2019
+++ ./configure Sat Sep 14 15:30:37 2019
@@ -3313,7 +3313,7 @@
cygwin*) MACHDEP="cygwin";;
darwin*) MACHDEP="darwin";;
atheos*) MACHDEP="atheos";;
- irix646) MACHDEP="irix6";;
+ irix6*) MACHDEP="irix6";;
'') MACHDEP="unknown";;
esac
fi
@@ -3459,7 +3459,7 @@

if test ! -z "$SGI_ABI"
then
- CC="cc $SGI_ABI"
+ CC="$CC $SGI_ABI"
LDFLAGS="$SGI_ABI $LDFLAGS"
MACHDEP=`echo "${MACHDEP}${SGI_ABI}" | sed 's/ *//g'`
fi
--- ./Lib/distutils/sysconfig.py Tue Sep 3 15:44:04 2019
+++ ./Lib/distutils/sysconfig.py Fri Sep 13 01:13:00 2019
@@ -192,16 +192,14 @@
if 'CPP' in os.environ:
cpp = os.environ['CPP']
else:
- cpp = cc + " -E" # not always
+ cpp = cc + " -P" # not always
if 'LDFLAGS' in os.environ:
ldshared = ldshared + ' ' + os.environ['LDFLAGS']
if 'CFLAGS' in os.environ:
cflags = opt + ' ' + os.environ['CFLAGS']
- ldshared = ldshared + ' ' + os.environ['CFLAGS']
if 'CPPFLAGS' in os.environ:
cpp = cpp + ' ' + os.environ['CPPFLAGS']
cflags = cflags + ' ' + os.environ['CPPFLAGS']
- ldshared = ldshared + ' ' + os.environ['CPPFLAGS']
if 'AR' in os.environ:
ar = os.environ['AR']
if 'ARFLAGS' in os.environ:
--- ./Lib/distutils/unixccompiler.py Tue Sep 3 15:53:47 2019
+++ ./Lib/distutils/unixccompiler.py Sun Jan 5 16:56:44 2020
@@ -57,10 +57,10 @@
# Python extensions).
executables = {'preprocessor' : None,
'compiler' : ["cc"],
- 'compiler_so' : ["cc"],
- 'compiler_cxx' : ["cc"],
- 'linker_so' : ["cc", "-shared"],
- 'linker_exe' : ["cc"],
+ 'compiler_so' : ["cc -KPIC"],
+ 'compiler_cxx' : ["CC"],
+ 'linker_so' : ["ld", "-shared"],
+ 'linker_exe' : ["ld"],
'archiver' : ["ar", "-cr"],
'ranlib' : None,
}



Unittests which fail(ed) are:

test_bsddb185
This fails on the byte check for a particular test database. I've checked this with db_dump185 in the db4 package and it turns out that SGI's bsddb 1.8.5 version in /usr/lib32/libdb.a is not compatible with the test185.db database in the Python test directory, but it does work for db files like /etc/mail/aliases.db. Nevertheless, bsddb185 is buggy and deprecated, and can be replaced entirely by a db4 implementation.

test_codecs
see test_locale

test_ctypes
There are at least two bugs: one bug when returning a NULL Python object pointer to callproc.c and its NULL reference in GetResult:callproc.c triggering a segfault. The latter can be fixed with a patch by checking for the NULL pointer in advance before a call to Py_DECREF() is made. This will cause an exception if the first bug isn't fixed, but that is much better than a segfault in the python module.

A separate bug concerns the qsort test. This test in ctypes incorrectly sorts a string: It looks like it has problems swapping bytes around.
For this to have a minimal amount of failures, you need a recent libffi with fixes from didbs or dual_mips3_mips4 nekoware. See also https://tudl1910.home.xs4all.nl/nekoware/dual-mips3-mips4/relnotes_patches/libffi-3.2.1_irix.patch

--- ./Modules/_ctypes/_ctypes.c Thu Aug 29 03:04:27 2019
+++ ./Modules/_ctypes/_ctypes.c Tue Sep 3 11:04:21 2019
@@ -4092,7 +4092,7 @@
}
}

- result = _ctypes_callproc(pProc,
+ result = _ctypes_callproc((PPROC)pProc,
callargs,
#ifdef MS_WIN32
piunk,
--- ./Modules/_ctypes/callproc.c Tue Sep 3 10:43:04 2019
+++ ./Modules/_ctypes/callproc.c Thu Sep 19 16:32:17 2019
@@ -834,7 +834,7 @@
#endif
delta =
#endif
- ffi_call(&cif, (void *)pProc, resmem, avalues);
+ ffi_call(&cif, FFI_FN(pProc), resmem, avalues);
#ifdef MS_WIN32
#ifndef DONT_USE_SEH
}
@@ -934,7 +934,7 @@
O_get), we have to call Py_DECREF because O_get has already
called Py_INCREF.
*/
- if (dict->getfunc == _ctypes_get_fielddesc("O")->getfunc) {
+ if (retval && dict->getfunc == _ctypes_get_fielddesc("O")->getfunc) {
Py_DECREF(retval);
}
} else


test_distutils
This tests the various compiler tools on the python binary but fails on test_config_cmd.py in line 50 where preprocessing is tested with search_cpp from Lib/distutils/command/config.py . What happens is that an 'empty' c file with body /* xxx */ is sent throught the preprocessor stage. Unlike the first test, which succeeds, the second test assumes that the preprocessing output can be redirected with -o _configtest.i option and checks for that filename, but MIPSPro can't do that with cc -P. This is the same situation on AIX, see https://bugs.python.org/issue11191 : it is there that they recommended skipping the test on AIX and so do we.

--- ./Lib/distutils/tests/test_config_cmd.py Fri Jan 3 17:11:02 2020
+++ ./Lib/distutils/tests/test_config_cmd.py Sun Jan 5 16:49:35 2020
@@ -38,6 +38,7 @@
self.assertEqual(len(self._logs), numlines+1)

@unittest.skipIf(sys.platform == 'win32', "can't test on Windows")
+ @unittest.skipIf(sys.platform.startswith('irix6'), 'issue #11191: IRIX also affected')
def test_search_cpp(self):
pkg_dir, dist = self.create_dist()
cmd = config(dist)
 
Last edited:
  • Like
Reactions: Elf and hammy

dexter1

New member
Jul 26, 2019
12
11
3
Zoetermeer, the Netherlands
test_fileio
The failure is the test that /dev/tty's should not be fseekable, but in IRIX (and AIX and SunOS) they actually are. This has been ticketed and marked as "Won't Fix' in https://smartos.org/bugview/OS-4023 so the patch adds IRIX to the list of fseekable /dev/tty OS'ses.

--- ./Lib/test/test_fileio.py Sun Sep 8 15:34:30 2019
+++ ./Lib/test/test_fileio.py Sun Sep 8 15:34:45 2019
@@ -312,7 +312,7 @@
self.assertEqual(f.writable(), True)
if sys.platform != "darwin" and \
'bsd' not in sys.platform and \
- not sys.platform.startswith(('sunos', 'aix')):
+ not sys.platform.startswith(('sunos', 'aix', 'irix6')):
# Somehow /dev/tty appears seekable on some BSDs
self.assertEqual(f.seekable(), False)
self.assertEqual(f.isatty(), True)


test_gzip
A checksum error in the gzip file manifests this bug, but this bug is a bit ethereal. It usually happens when the system is running for some time causing the random filename generator in the unittest module to produce filenames with 13 characters instead of 12 because it generates the filename from the PID the test_gzip.py program instance is given. It then turns out that for some filename sizes in the gzip module the fseeko/fseek64 function produces wrong results, i.e. misses the target offset by 8 bytes, so the patch fixes that by falling back on fgetpos/fsetpos. This might be relevant for more libraries and programs, even outside Python...

--- ./Objects/fileobject.c Fri Sep 20 02:09:08 2019
+++ ./Objects/fileobject.c Fri Sep 20 02:18:59 2019
@@ -702,6 +702,18 @@
static int
_portable_fseek(FILE *fp, Py_off_t offset, int whence)
{
+/* Turns out that IRIX' fseeko() and fseek64() functions are both broken.
+ * The test_gzip.py check sometimes fail if the gzip filename was 13
+ * characters long, resulting in seeks with an additional -8 offset,
+ * causing the crc32 check to fail.
+ * This bug was not immediately noticable because the filename was
+ * randomly generated with a length depending on the uptime of the machine,
+ * and one had to wait about an our or so for the test to fail... */
+#if defined(__sgi)
+#undef HAVE_FSEEKO
+#undef HAVE_FSEEK64
+#endif
+
#if !defined(HAVE_LARGEFILE_SUPPORT)
return fseek(fp, offset, whence);
#elif defined(HAVE_FSEEKO) && SIZEOF_OFF_T >= 8


test_httpservers
The bug is that paths without trailing slashes aren't suppose to work, but yet they do. So this is a true bug.

test_io
In test_io.check_interrupted_write() there is a problem as described in https://bugs.python.org/issue12429 . The read thread will sometimes fail reading one byte because the pipe isn't filled yet from the write thread, a classic race condition. Some freeBSD versions have this problem as well, and they skipped the test for these...

--- ./Lib/test/test_io.py Thu Sep 12 23:49:15 2019
+++ ./Lib/test/test_io.py Fri Sep 13 00:43:55 2019
@@ -3171,6 +3171,7 @@
@unittest.skipUnless(threading, 'Threading required for this test.')
@unittest.skipIf(sys.platform in ('freebsd5', 'freebsd6', 'freebsd7'),
'issue #12429: skip test on FreeBSD <= 7')
+ @unittest.skipIf(sys.platform.startswith('irix6'), 'issue #12429: IRIX affected')
def check_interrupted_write(self, item, bytes, **fdopen_kwargs):
"""Check that a partial write, when it gets interrupted, properly
invokes the signal handler, and bubbles up the exception raised


test_locale
This bug apparently manifests IRIX failure setting a locale. If setting it to 'en_US' the 'setlocale' is okay, but subsequent number formatting using this locale fails, notably the thousands separator. Cooked locales do work fine. I've tried to add 'en_US.ISO8859-15' to the list of admissible IRIX locales but that didn't work. I suspect the printf() libc function is not modern enough to include the "'%d" as a thousands-separator formatter, just as with not having "%zd" and "%zu" for size_t and ssize_t variables.

test_multiprocessing
This fails for ordinary users, but succeeds for root. Has to do with semaphore file creation on the filesystem.

What most people have done previously is to change the leading slash of the semaphore filename in SEM_CREAT (macro for sem_open) in Modules/_multiprocessing/semaphore.c to '/tmp/', so the semaphore is on a path in /tmp folder, which is why i added this both in ./configure and in Modules/_multiprocessing/semaphore.c . I don't know if this fixes everything, but since it's being used by other Modules, we'll soon find out :)

--- ./configure Thu Sep 12 13:08:47 2019
+++ ./configure Sat Sep 14 15:30:37 2019
@@ -13302,13 +13309,13 @@
#include <sys/stat.h>

int main(void) {
- sem_t *a = sem_open("/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
+ sem_t *a = sem_open("/tmp/autoconf", O_CREAT, S_IRUSR|S_IWUSR, 0);
if (a == SEM_FAILED) {
perror("sem_open");
return 1;
}
sem_close(a);
- sem_unlink("/autoconf");
+ sem_unlink("/tmp/autoconf");
return 0;
}

@@ -13353,7 +13360,7 @@
#include <sys/stat.h>

int main(void){
- sem_t *a = sem_open("/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
+ sem_t *a = sem_open("/tmp/autocftw", O_CREAT, S_IRUSR|S_IWUSR, 0);
int count;
int res;
if(a==SEM_FAILED){
@@ -13363,7 +13370,7 @@
}
res = sem_getvalue(a, &count);
sem_close(a);
- sem_unlink("/autocftw");
+ sem_unlink("/tmp/autocftw");
return res==-1 ? 1 : 0;
}
--- ./Modules/_multiprocessing/semaphore.c Sat Sep 14 13:24:47 2019
+++ ./Modules/_multiprocessing/semaphore.c Sat Sep 14 13:53:04 2019
@@ -446,7 +446,7 @@
do {
unsigned long suffix;
_PyOS_URandom((char *)&suffix, sizeof(suffix));
- PyOS_snprintf(buffer, sizeof(buffer), "/mp%ld-%lu", (long)getpid(),
+ PyOS_snprintf(buffer, sizeof(buffer), "/tmp/mp%ld-%lu", (long)getpid(),
suffix);
SEM_CLEAR_ERROR();
handle = SEM_CREATE(buffer, value, maxvalue);



Oh and you need this patch to let python determine the amount of processors:

--- ./Lib/multiprocessing/__init__.py Tue Sep 3 08:56:01 2019
+++ ./Lib/multiprocessing/__init__.py Tue Sep 3 08:58:16 2019
@@ -124,6 +124,12 @@
num = int(p.read())
except ValueError:
num = 0
+ elif 'irix' in sys.platform:
+ try:
+ with os.popen('/usr/sbin/sysconf NPROC_ONLN') as p:
+ num = int(p.read())
+ except (ValueError, OSError, AttributeError):
+ num = 0
else:
try:
num = os.sysconf('SC_NPROCESSORS_ONLN')


test_os
This failure in test_unset_error is looking at the return value of unsetenv but IRIX doesn't have unsetenv returning an int. This is fixed in the patch adding a setenv/unsetenv function from Michael Kerrisk's proc/setenv.c , with thanks to the contributors in the discussion from http://forums.irixnet.org/thread-201.html

--- ./Modules/posixmodule.c Sat Sep 14 22:28:52 2019
+++ ./Modules/posixmodule.c Fri Sep 20 13:42:08 2019
@@ -173,6 +173,8 @@
/* declare ctermid_r if compiling with MIPSPro 7.x in ANSI C mode
(default) */
extern char *ctermid_r(char *);
+#define HAVE_UNSETENV 1
+#include "setenv.c"
#endif

#ifndef HAVE_UNISTD_H
 
  • Like
Reactions: Elf and hammy

dexter1

New member
Jul 26, 2019
12
11
3
Zoetermeer, the Netherlands
test_posix
Two failures: The first one involves testing for chown operations by users. The python script expects them to fail since users cannot chown files to other users in BSD type chown, however the chown on IRIX is from System V and it allows chowning files to other users. There are two possible fixes for this particular bug:

1) Add IRIX to line 341 of Lib/test/test_posix.py:

elif platform.system() in ('HP-UX', 'SunOS', 'IRIX'):

This skips the test for IRIX systems

2) Issue as root: systune restricted_chown 1
and reboot the system

This will change the behavior of chown to BSD type: ordinary users cannot chown files to other users. Since this also is a security risk if they can do this, it is recommended to always set this kernel parameter.

The second failure is reopening a read-only file descriptor as write-only via posix.fdopen. POSIX implementations should get an EINVAL error but IRIX doesn't do that and flips the file descriptor to write-only. So this is clearly a bug and the patch skips this test.

--- ./Lib/test/test_posix.py Sun Sep 8 19:23:00 2019
+++ ./Lib/test/test_posix.py Sun Sep 8 19:26:07 2019
@@ -208,7 +208,8 @@
self.assertEqual(cm.exception.errno, errno.EISDIR)

@unittest.skipUnless(hasattr(posix, 'fdopen') and
- not sys.platform.startswith("sunos"),
+ not (sys.platform.startswith('sunos')
+ or sys.platform.startswith('irix6')),
'test needs posix.fdopen()')
def test_fdopen_keeps_fd_open_on_errors(self):
fd = os.open(test_support.TESTFN, os.O_RDONLY)


test_signal
Can't reproduce this one yet with OPT=-g. Suspect a race condition.

test_time
This is a bug in which IRIX mktime() is been given a negative time of -2. IRIX' mktime implementation is incomplete and will return -1 for every negative number. I have fixed this by adding a separate my_mktime() function as C code.

Also, because the python module uses the weekday as a sentinel for checking if the mk_time function has actually done something, i added the weekday code calculation as well.

--- ./Modules/timemodule.c Sun Sep 8 00:04:49 2019
+++ ./Modules/timemodule.c Sun Sep 8 20:45:06 2019
@@ -91,6 +91,10 @@
extern int riscos_sleep(double);
#endif

+#ifdef __sgi
+#include "my_mktime.c"
+#endif
+
/* Forward declarations */
static int floatsleep(double);
static double floattime(void);
@@ -731,7 +735,7 @@
if (!gettmarg(tup, &buf))
return NULL;
buf.tm_wday = -1; /* sentinel; original value ignored */
- tt = mktime(&buf);
+ tt = my_mktime(&buf);
/* Return value of -1 does not necessarily mean an error, but tm_wday
* cannot remain set to -1 if mktime succeeded. */
if (tt == (time_t)(-1) && buf.tm_wday == -1) {


test_urllib2_localnet
Can't reproduce this one yet with OPT=-g but i think i've fixed this with a kernel parameter: systune rlimit_nofile_cur 400 (instead of 200) (i don't see it on certain builds anymore: Race condition?)

To include the extra sgi specific modules, you need these patches:

--- Setup Fri Aug 30 11:14:03 2019
+++ Setup Thu Jan 2 20:56:18 2020
@@ -140,7 +140,7 @@
# The SGI specific GL module:

GLHACK=-Dclear=__GLclear
-#gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11
+gl glmodule.c cgensupport.c -I$(srcdir) $(GLHACK) -lgl -lX11

# Pure module. Cannot be linked dynamically.
# -DWITH_QUANTIFY, -DWITH_PURIFY, or -DWITH_ALL_PURE
@@ -153,7 +153,7 @@
# modules are to be built as shared libraries (see above for more
# detail; also note that *static* reverses this effect):

-#*shared*
+*shared*

# GNU readline. Unlike previous Python incarnations, GNU readline is
# now incorporated in an optional module, configured in the Setup file
@@ -267,8 +267,8 @@
# These module work on any SGI machine:

# *** gl must be enabled higher up in this file ***
-#fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager
-#sgi sgimodule.c # sgi.nap() and a few more
+fm fmmodule.c $(GLHACK) -lfm -lgl # Font Manager
+sgi sgimodule.c # sgi.nap() and a few more

# This module requires the header file
# /usr/people/4Dgifts/iristools/include/izoom.h:
@@ -277,8 +277,8 @@

# These modules require the Multimedia Development Option (I think):

-#al almodule.c -laudio # Audio Library
-#cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library
+al almodule.c -laudio # Audio Library
+cd cdmodule.c -lcdaudio -lds -lmediad # CD Audio Library
#cl clmodule.c -lcl -lawareaudio # Compression Library
#sv svmodule.c yuvconvert.c -lsvideo -lXext -lX11 # Starter Video

@@ -294,8 +294,8 @@
# The FORMS variable must point to the FORMS subdirectory of the forms
# toplevel directory:

-#FORMS=/ufs/guido/src/forms/FORMS
-#fl flmodule.c -I$(FORMS) $(GLHACK) $(FORMS)/libforms.a -lfm -lgl
+FORMS=/usr/nekoware/include
+fl flmodule.c -I$(FORMS) $(GLHACK) -lforms -lfm -lgl


# SunOS specific modules -- off by default:
--- Modules/makesetup Sat Mar 2 19:17:42 2019
+++ Modules/makesetup Tue Jan 7 00:45:46 2020
@@ -211,7 +211,6 @@
obj="$srcdir/$obj"
objs="$objs $obj"
case $src in
- glmodule.c) ;;
/*) ;;
\$*) ;;
*) src='$(srcdir)/'"$srcdir/$src";;
@@ -231,7 +230,7 @@
do
case $objs in
*$mod.o*) base=$mod;;
- *) base=${mod}module;;
+ *) base=${mod};;
esac
file="$srcdir/$base\$(SO)"
case $doconfig in
--- ./Modules/fmmodule.c Sat Sep 21 00:57:47 2019
+++ ./Modules/fmmodule.c Sat Sep 21 00:59:25 2019
@@ -257,11 +257,12 @@
void
initfm(void)
{
+ PyObject *m;
if (PyErr_WarnPy3k("the fm module has been removed in "
"Python 3.0", 2) < 0)
return;

- Py_InitModule("fm", fm_methods);
+ m = Py_InitModule("fm", fm_methods);
if (m == NULL)
return;
fminit();
--- ./Modules/flmodule.c Sat Sep 21 01:00:37 2019
+++ ./Modules/flmodule.c Sat Sep 21 01:02:33 2019
@@ -716,17 +716,17 @@
{"load_browser", (PyCFunction)load_browser,
METH_OLDARGS},
{"get_browser_maxline", (PyCFunction)get_browser_maxline,
- METH_NOARGS,}
+ METH_NOARGS,},
{"select_browser_line", (PyCFunction)select_browser_line,
METH_OLDARGS},
{"deselect_browser_line", (PyCFunction)deselect_browser_line,
METH_OLDARGS},
{"deselect_browser", (PyCFunction)deselect_browser,
- METH_NOARGS,}
+ METH_NOARGS,},
{"isselected_browser_line", (PyCFunction)isselected_browser_line,
METH_OLDARGS},
{"get_browser", (PyCFunction)get_browser,
- METH_NOARGS,}
+ METH_NOARGS,},
{"set_browser_fontsize", (PyCFunction)set_browser_fontsize,
METH_OLDARGS},
{"set_browser_fontstyle", (PyCFunction)set_browser_fontstyle,
@@ -2124,11 +2124,12 @@
PyMODINIT_FUNC
initfl(void)
{
+ PyObject *m;
if (PyErr_WarnPy3k("the fl module has been removed in "
"Python 3.0", 2) < 0)
return;

- Py_InitModule("fl", forms_methods);
+ m = Py_InitModule("fl", forms_methods);
if (m == NULL)
return;
foreground();


After running the unittests, there are six failed tests:

6 tests failed:
test_codecs test_ctypes test_httpservers test_locale
test_multiprocessing test_urllib2_localnet


I'll add a link to the three patches and the neko-python.txt build instructions:

neko_python.txt
Python-2.7.16_irix.patch
Python-2.7.16_extra_irix_files.patch
Python-2.7.16_irix_Setup.patch

Comments, suggestions and improvements are always welcome.
 
Last edited:

hammy

Active member
Jun 1, 2019
108
68
28
UK
Very nice, appreciate the effort that goes into something like this. Hopefully someone can step up to the plate and work this into an RPM (not you Dexter, but hint hint) :)

Cheers!
 
  • Like
Reactions: Elf

Elf

Storybook / Retired, ex-staff
Feb 4, 2019
792
252
63
Mountain West (US)
Thanks Elf, i've reposted my Python topic from IN to here, but i needed to shorten it. My post seems to be too long for the forum system, so i've split the post in three parts.
Thank you very much for putting in the effort to uncover all that, and the effort to repost the information here as well! :)

Sorry about the length limit, I've run into that myself. I'll see if there is any setting to change for the future.

I am sure we will make good use of this Python work, especially as Python is on the path to having a functional yum for RPM fetching and dependency resolution.
 

About us

  • Silicon Graphics User Group (SGUG) is a community for users, developers, and admirers of Silicon Graphics (SGI) products. We aim to be a friendly hobbyist community for discussing all aspects of SGIs, including use, software development, the IRIX Operating System, and troubleshooting, as well as facilitating hardware exchange.

User Menu