DroboApp announcement: python-2.7.2

Latest version of python avaiable for download. This one is updated with all the latest releases of the dependencies, and uses better compiler flags. In short, it should be faster and it is smaller than the previous version.

You can find it here: http://www.droboports.com/app-repository/python-2-7-2

As usual, comments, suggestions and feedback are welcome.

how to upgrade from 2.7.1?

Just install like you did the first time.

we would have to migrate any existing modules correct?

I don’t think so. Since it’s a minor release, I don’t expect any incompatible API changes. The existing modules, if you were to reinstall them, would all go back to the same place.

In any case, if you have some hard-to-rebuild setup, I strongly suggest making a backup copy of your python folder before upgrading.

Since the new release created a new folder named python2.7.2 other than using the existing python folder (I copied the gz file onto DroboApps and ran the install script), in my case, I have to re-link python to the new folder and re-install all modules again.

All apps, SABnzbdPlus, BeautifulSoup, Sickbeard, CouchPotato, LazyLibrarian and others, works well with new release.

BTW. my SABnzbdPlus still doesn’t have SSL option with new 2.7.2 release. Is there something wrong with my installation?
BTW 2. would you mind to compile the latest Python 2.7.3? Perhaps 3.2.3 as well?

Thank you.

I ran into this as well, @ricardo solved the problem in this forum:

http://www.drobospace.com/forums/showthread.php?tid=8882

HOW did you get CouchPotato to run??? I figured that I need pysqlite, but generally speaking the thing never starts for me, or rather it runs then quits.

pyOpenSSL works for me now. Thanks you.

As per CP, I just download and unzipped it, created a service.sh file and it works naturally. It does not ask about pysqlite.

I usually don’t bother with a new version until it is final. As far as I can tell 2.7.3 is still only an RC. Last time I tried, the 3.x series was such a pain that I was unable to cross-compile it. I’ll have a look again when I have some time.

nevermind with my confusion on couchpotato. i had transmission stealing port 5000

seems I’m having trouble running the latest couchpotato (v2) using this build of python.

when it starts up (verbosely) it spits out this at the end:

/mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/_endian.pyc matches /mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/_endian.py

import ctypes._endian # precompiled from /mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/_endian.pyc
Aborted

not sure why endian is required, but for some reason this isnt working on the drobo (works fine on my mac) any way to fix this?[hr]
so from my noob knowledge this appears to be a windows dependency. ive been able to get around it by simply excluding the import from couchpotato although id love to know why this worked fine on my mac but didnt on the drobo… does ctypes need cross compiling? why would only endian be causing issues?

The thing is that ctypes is already cross-compiled. I honestly have no clue why this happened to you.

Yeah everything but endian loads fine. Really odd stuff. I wonder if anyone else can run v2.

I’ve hit this same problem trying to get flexget installed. Flexget needs requests https://github.com/kennethreitz/requests to function and it can’t compile because of this crash.

import ctypes # precompiled from /mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/init.pyc
dlopen("/mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/lib-dynload/_ctypes.so", 2);
import _ctypes # dynamically loaded from /mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/lib-dynload/_ctypes.so

/mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/_endian.pyc matches /mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/_endian.py

import ctypes._endian # precompiled from /mnt/DroboFS/Shares/DroboApps/python2/lib/python2.7/ctypes/_endian.pyc
Aborted

I am having the same issue with endian from ctypes. I can even replicate just by going:

python -c ‘import ctypes._endian’

Aborted

I am trying to re-cross-compile but having trouble with zlib:

CFLAGS="$CFLAGS -O3" ./configure --prefix=$DEST --static

Building static library libz.a version 1.2.7 with /usr/local/arm-2007q1/bin/arm-none-linux-gnueabi-gcc.
Checking for off64_t… Yes.
Checking for fseeko… Yes.
Checking for strerror… Yes.
Checking for unistd.h… Yes.
Checking for stdarg.h… Yes.
Checking whether to use vs[n]printf() or s[n]printf()… using vs[n]printf().
Checking for vsnprintf() in stdio.h… Yes.
Checking for return value of vsnprintf()… Yes.
Checking for attribute(visibility) support… Yes.
./ztest2283: 1: Syntax error: word unexpected (expecting “)”)
Looking for a four-byte integer type… Not found.

You can safely ignore that error. It affects just the zlib tests.

How can I have the configure script ignore that error? Should I just rip out that section of the configure file?

I’d like to get the ‘ctypes._endian’ import fixed up as it’s a prerequisite for CouchPotato. Not sure if recompiling Python is the best route but it seems like it might be worth a shot.

edit: oh I see, the configure script ran successfully, I thought it failed because of that error. My bad. I’m at work and can’t test the recompiled ctypes module on my actual Drobo FS(only have the VM here) but I’ll update you later

Yep, recompiled with the Ubuntu cross-compiling VM and am getting the same results on my Drobo FS:

./python -v -c ‘import ctypes._endian’

installing zipimport hook

import zipimport # builtin

installed zipimport hook

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/site.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/site.py

import site # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/site.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/os.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/os.py

import os # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/os.pyc
import errno # builtin
import posix # builtin

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/posixpath.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/posixpath.py

import posixpath # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/posixpath.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/stat.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/stat.py

import stat # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/stat.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/genericpath.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/genericpath.py

import genericpath # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/genericpath.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/warnings.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/warnings.py

import warnings # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/warnings.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/linecache.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/linecache.py

import linecache # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/linecache.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/types.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/types.py

import types # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/types.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/UserDict.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/UserDict.py

import UserDict # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/UserDict.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/_abcoll.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/_abcoll.py

import _abcoll # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/_abcoll.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/abc.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/abc.py

import abc # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/abc.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/_weakrefset.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/_weakrefset.py

import _weakrefset # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/_weakrefset.pyc
import _weakref # builtin

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/copy_reg.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/copy_reg.py

import copy_reg # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/copy_reg.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/traceback.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/traceback.py

import traceback # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/traceback.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sysconfig.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sysconfig.py

import sysconfig # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sysconfig.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/re.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/re.py

import re # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/re.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_compile.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_compile.py

import sre_compile # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_compile.pyc
import _sre # builtin

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_parse.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_parse.py

import sre_parse # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_parse.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_constants.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_constants.py

import sre_constants # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/sre_constants.pyc
import encodings # directory /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/init.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/init.py

import encodings # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/init.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/codecs.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/codecs.py

import codecs # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/codecs.pyc
import _codecs # builtin

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/aliases.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/aliases.py

import encodings.aliases # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/aliases.pyc

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/ascii.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/ascii.py

import encodings.ascii # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/encodings/ascii.pyc
Python 2.7.3 (default, Oct 29 2012, 00:21:27)
[GCC 4.2.0 20070413 (prerelease)] on linux2
Type “help”, “copyright”, “credits” or “license” for more information.
import ctypes # directory /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/ctypes

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/ctypes/init.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/ctypes/init.py

import ctypes # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/ctypes/init.pyc
dlopen("/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/lib-dynload/_ctypes.so", 2);
import _ctypes # dynamically loaded from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/lib-dynload/_ctypes.so

/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/struct.pyc matches /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/struct.py

import struct # precompiled from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/struct.pyc
dlopen("/mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/lib-dynload/_struct.so", 2);
import _struct # dynamically loaded from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/lib-dynload/_struct.so
import ctypes._endian # from /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/ctypes/_endian.py

wrote /mnt/DroboFS/Shares/DroboApps/py2/lib/python2.7/ctypes/_endian.pyc

Aborted

Where do we look next?

interesting:

python -c ‘import ctypes’

Aborted

edit: aha http://whocares.de/finally-a-fix-for-python-2-7-aborts-on-import-of-ctypes/ patching…

EDIT: CONFIRMED! That patch works. Well, not that patch exactly – it didn’t apply for me from his patch file – but the same idea.

[code]±-- a/Modules/_ctypes/libffi/src/closures.c 2012-04-10 01:07:33.000000000 +0200
++++ b/Modules/_ctpyes/libffi/src/closures.c 2012-06-20 17:35:40.277850045 +0200
+@@ -119,52 +119,7 @@

  • #define LACKS_SYS_MMAN_H 1
  • #if FFI_MMAP_EXEC_SELINUX
    ±#include <sys/statfs.h>
    ±#include <stdlib.h>
    ±
    ±static int selinux_enabled = -1;
    ±
    ±static int
    ±selinux_enabled_check (void)
    ±{
    ± struct statfs sfs;
    ± FILE *f;
    ± char *buf = NULL;
    ± size_t len = 0;
    ±
    ± if (statfs ("/selinux", &sfs) >= 0
    ± && (unsigned int) sfs.f_type == 0xf97cff8cU)
    ± return 1;
    ± f = fopen ("/proc/mounts", “r”);
    ± if (f == NULL)
    ± return 0;
    ± while (getline (&buf, &len, f) >= 0)
    ± {
    ± char *p = strchr (buf, ’ ');
    ± if (p == NULL)
    ± break;
    ± p = strchr (p + 1, ’ ');
    ± if (p == NULL)
    ± break;
    ± if (strncmp (p + 1, "selinuxfs ", 10) != 0)
    ± {
    ± free (buf);
    ± fclose (f);
    ± return 1;
    ± }
    ± }
    ± free (buf);
    ± fclose (f);
    ± return 0;
    ±}
    ±
    ±#define is_selinux_enabled() (selinux_enabled >= 0 ? selinux_enabled
    ± : (selinux_enabled = selinux_enabled_check ()))
    ±
    ±#else
    ±
  • #define is_selinux_enabled() 0
    ±
  • #endif /* !FFI_MMAP_EXEC_SELINUX */[/code]

Nice catch!

If I understand this correctly, this removes support for SELINUX completely, right?

I wonder if instead of applying the patch, compiling libffi separately wouldn’t make more sense.

UPDATE: I recompiled it using a separate version of libffi and it does not abort anymore when running “python -c ‘import ctypes’”.