twisted / twisted

Event-driven networking engine written in Python.
https://twisted.org
Other
5.57k stars 1.17k forks source link

get twisted to run on jython #3413

Open twisted-trac opened 16 years ago

twisted-trac commented 16 years ago
glyph's avatar @glyph reported
Trac ID trac#3413
Type enhancement
Created 2008-09-06 16:56:46Z
Branch https://github.com/twisted/twisted/tree/jython-3413-3

There are some other tickets which imply this as a goal, but it hasn't been made explicit that this is desired.

This ticket should be closed when we have a jython buildbot that is green.

== Related tickets ==

Attachments:

Searchable metadata ``` trac-id__3413 3413 type__enhancement enhancement reporter__glyph glyph priority__normal normal milestone__ branch__branches_jython_3413_3 branches/jython-3413-3 branch_author__thijs__glyph thijs, glyph status__new new resolution__None None component__core core keywords__jython jython time__1220720206000000 1220720206000000 changetime__1437574984699326 1437574984699326 version__None None owner__ cc__thijs cc__oberstet cc__tkanerva cc__Arfrever ```
twisted-trac commented 13 years ago
Automation's avatar Automation removed owner
twisted-trac commented 10 years ago
hongleij's avatar hongleij commented

Twisted14.0/Win8.1/Jython2.7b3

F:\PythonDev\build\Twisted>jython.bat setup.py build Traceback (most recent call last): File "setup.py", line 73, in main(sys.argv[1:]) File "setup.py", line 73, in main(sys.argv[1:]) File "setup.py", line 55, in main from twisted.python.dist import ( File ".\twisted\python\dist.py", line 22, in from twisted import copyright ImportError: cannot import name copyright

F:\PythonDev\build\Twisted>jython Jython 2.7b3 (default:5efdcedc9817, Jun 28 2014, 19:17:21) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_05 Type "help", "copyright", "credits" or "license" for more information.

twisted-trac commented 10 years ago
hongleij's avatar hongleij commented

Twisted13.2/Win8.1 64bit/Jython2.7b3

Traceback (most recent call last): File "F:\PythonDev\build\Test2\main.py", line 4, in from twisted.internet import protocol, reactor, endpoints File "C:\jython2.7b3\Lib\site-packages\twisted\internet\protocol.py", line 18, in from twisted.internet import interfaces, error, defer File "C:\jython2.7b3\Lib\site-packages\twisted\internet\defer.py", line 29, in from twisted.python import lockfile, log, failure File "C:\jython2.7b3\Lib\site-packages\twisted\python\lockfile.py", line 23, in from os import kill ImportError: cannot import name kill

Jython 2.7b3 (default:5efdcedc9817, Jun 28 2014, 19:17:21) [Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.8.0_05 Type "help", "copyright", "credits" or "license" for more information.

twisted-trac commented 9 years ago
hawkowl's avatar @hawkowl commented

Current status on Jython 2.7 release, on OS X, with no deps: FAILED (skips=809, failures=48, errors=407, successes=2905)

twisted-trac commented 9 years ago
glyph's avatar @glyph commented

Replying to hawkowl:

Current status on Jython 2.7 release, on OS X, with no deps: FAILED (skips=809, failures=48, errors=407, successes=2905)

trunk, or the linked branch?

If trunk - can we get an unsupported builder?

twisted-trac commented 9 years ago
hawkowl's avatar @hawkowl commented

Replying to glyph:

Replying to hawkowl:

Current status on Jython 2.7 release, on OS X, with no deps: FAILED (skips=809, failures=48, errors=407, successes=2905)

trunk, or the linked branch?

If trunk - can we get an unsupported builder?

trunk (on OS X)

I'll install Jython on the 15.04 buildbots and get an unsupported builder.

twisted-trac commented 9 years ago
hawkowl's avatar @hawkowl commented

The builder has been added: http://buildbot.twistedmatrix.com/builders/ubuntu15.04-jython2.7

twisted-trac commented 14 years ago
thijstriemstra's avatar @thijstriemstra commented

(In [27705]) Branching to 'jython-3413-2'

twisted-trac commented 14 years ago
thijstriemstra's avatar @thijstriemstra commented

(In [27706]) Merge forward. refs #3413

twisted-trac commented 11 years ago
oberstet's avatar @oberstet commented

A more robust way to work around issue 2) is:

class Platform:
    """Gives us information about the platform we're running on"""

    if os.name == 'java' and hasattr(os, '_name'):
        ## see:
        ## http://bugs.jython.org/issue1521
        ## http://bugs.jython.org/msg7927
        osName = os._name
    else:
        osName = os.name
    type = knownPlatforms.get(osName)
twisted-trac commented 11 years ago
oberstet's avatar @oberstet commented

I was able to get Jython 2.7b1 to run Autobahn/Twisted with 2 minor tweaks. I'd like to discuss those tweaks before going through a proper patch/trial/etc cycle ..

1) Missing builtin.buffer

The following is a workaround due to http://bugs.jython.org/issue1521

Include

# workaround for Jython, see: http://bugs.jython.org/issue1521
import __builtin__
if not hasattr(__builtin__, 'buffer'):
    def _buffer(object, offset = None, size = None):
       if offset is None:
          offset = 0
       if size is None:
          size = len(object)
       return object[offset:offset+size]
    __builtin__.buffer = _buffer

at the beginning of "twisted/python/compat.py".

2) Weird platform ident

Jython identifies itself as "Java" on any platform. I.e. this is on Windows:

Jython 2.7b1 (default:ac42d59644e9, Feb 9 2013, 15:24:52)
[Java HotSpot(TM) 64-Bit Server VM (Oracle Corporation)] on java1.7.0
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys, os
>>> sys.platform
'java1.7.0'
>>> os.name
'java'

Replace

def isWindows(self):
    if self.getType() == 'java':
        import java.lang.System
        realOs = java.lang.System.getProperty('os.name')
        return realOs.lower().startswith("windows")
    return self.getType() == 'win32'

within "twisted/python/runtime.py".

twisted-trac commented 11 years ago
normanmaurer's avatar normanmaurer commented

Any progress here ? I would really love to see this happen and so write a maven plugin that use the autobahntestsuite for running tests again a WebSocket server imll.

twisted-trac commented 11 years ago
exarkun's avatar @exarkun commented

All work on this issue is in the branch referenced in the ticket description. As far as getting a slave goes, we still don't have one.

twisted-trac commented 11 years ago
oberstet's avatar @oberstet commented

Having been asked, I hereby license the code in my comments above under the MIT license (same as Twisted). Not that I intended anything else anyway ..

twisted-trac commented 11 years ago
oberstet's avatar @oberstet commented

I just tried Twisted 13.0 / Jython 2.7b1 (already with above patches).

For whatever reasons I now encountered an additional issue: http://bugs.jython.org/issue2060

Workaround: patch twisted/python/threadable.py for

_dummyID = object()
def getThreadID():
    if threadingmodule is None:
        return _dummyID
    try:
        # workaround for broken Jython
        tid = threadingmodule.currentThread().ident
        return tid
    except AttributeError:
        return _dummyID
twisted-trac commented 11 years ago
thijstriemstra's avatar @thijstriemstra commented

Replying to thijs:

When running trial it dies with this error:

/home/thijs/Downloads/jython2.7b1/bin/jython bin/trial twisted
Traceback (most recent call last):
  File "bin/trial", line 17, in <module>
    from twisted.scripts.trial import run
ImportError: No module named trial

This was reported in august 2012, no fix as of yet: http://bugs.jython.org/issue1956

twisted-trac commented 11 years ago
exarkun's avatar @exarkun commented

#6745 was a duplicate of this.

twisted-trac commented 11 years ago
tkanerva's avatar tkanerva commented

I attached a set of three patches that should enable twisted.web to serve resources under jython 2.7.

There was some talk on #jython as to how to best check for jython at runtime, and the sys.platform string seems to be the most robust approach.

The implementation of checking thread.ident uses exception catching so that it should have a negligible perf impact on CPython (getting the thread ID is a somewhat common operation under many use cases).

twisted-trac commented 11 years ago
oberstet's avatar @oberstet commented

The missing thread ident seems to be fixed http://bugs.jython.org/issue2060 in the upcoming 2.7 release. If the goal is to support Jython >=2.7, then there is no need to work around at least this issue in Twisted ...

twisted-trac commented 11 years ago
thijstriemstra's avatar @thijstriemstra commented

(In [40022]) Branching to 'jython-3413-3'

twisted-trac commented 11 years ago
thijstriemstra's avatar @thijstriemstra commented

(In [40024]) use PY3 implementation of lazyByteSlice for jython2.7 as well, refs #3413

twisted-trac commented 11 years ago
thijstriemstra's avatar @thijstriemstra commented

Replying to oberstet:

A more robust way to work around issue 2) is:

Thanks for reporting this, I've opened a ticket at #6746 and assigned it to you ;)

twisted-trac commented 11 years ago
thijstriemstra's avatar @thijstriemstra commented

Replying to tkanerva:

I attached a set of three patches that should enable twisted.web to serve resources under jython 2.7.

Thanks for your patches. I merged this branch forward and applied the first one (jython-lazyByteSlice.diff), although slightly changed due to the merge-forward.

When running trial it dies with this error:

/home/thijs/Downloads/jython2.7b1/bin/jython bin/trial twisted
Traceback (most recent call last):
  File "bin/trial", line 17, in <module>
    from twisted.scripts.trial import run
ImportError: No module named trial

The other 2 patches don't apply cleanly, and I expect they also don't fix this trial issue which is crucial if we want to be able to maintain it. Can you create these patches against the current branch and possibly look into this trial issue and see if you can reproduce it?

twisted-trac commented 11 years ago
jimbaker's avatar jimbaker commented

The buffer builtin is now available in Jython trunk, as mirrored here - https://bitbucket.org/jython/jython For the moment, we should only be targeting Jython trunk with any Twisted on Jython work - given that we are actively trying to fix Jython for Twisted. With this in place, we can turn to more interesting problems.

To simplify dependency resolution, I'm actually running a slightly different branch, https://bitbucket.org/jimbaker/jython-ssl, which allows for the use of easy_install. (pip requires slightly more work, including presumably a patch to pip, because it does some crazy/illegal/interesting usage of Unicode, so as to detect illegal Unicode.) So to follow along:

in the git clone of Twisted trunk:

~/jython-dev/jython-ssl/dist/bin/easy_install zope.interfaces
~/jython-dev/jython-ssl/dist/bin/jython setup.py install  # develop should also work

With this, I can repeat not being able to get trial running. However, unlike the bug report here, http://bugs.jython.org/issue1956, I do not get java.lang.ArrayIndexOutOfBoundsException:

$ ~/jythondev/jython-ssl/dist/bin/trial twisted
Traceback (most recent call last):
  File "/Users/jbaker/jythondev/jython-ssl/dist/bin/trial", line 8, in <module>
    execfile(__file__)
  File "/Users/jbaker/jythondev/jython-ssl/dist/bin/trial", line 8, in <module>
    execfile(__file__)
  File "/Users/jbaker/opensource/twisted/bin/trial", line 17, in <module>
    from twisted.scripts.trial import run
ImportError: No module named trial

Running from the Jython console gets the same thing:

$ ~/jythondev/jython-ssl/dist/bin/jython
>>> from twisted.scripts import trial
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name trial

But twisted.scripts itself is available, along with twisted.trial. So something is not getting setup properly it seems. Maybe there's a platform dispatch that has gone wrong?

Let's turn to that issue. I want something to work, so I tried to use treq:

$ ~/jythondev/jython-ssl/dist/bin/easy_install treq

Then run a simple program, like this one:

from treq import get

def done(response):
    print response.code
    reactor.stop()

get("http://www.github.com").addCallback(done)

from twisted.internet import reactor
reactor.run()

This fails with AttributeError: 'module' object has no attribute 'pipe'

The problem here is that the reactor that's selected assumes full Posix, including os.pipe. However, os.pipe is not available on Jython. So it would seem that the solution that's required here is a reactor specific to Jython, much like has been done for Win32.

twisted-trac commented 10 years ago
radix's avatar @radix commented

It's rather strange that you get an import error for twisted.scripts.trial -- it's simply a normal module that should exist as twisted/scripts/trial.py on your filesystem. Can you verify that it's actually there? If not, there's probably something wrong with the installation process. It'd be helpful to know what twisted.scripts.file and twisted.scripts.path are at run-time, for information-gathering purposes. There shouldn't be anything strange about them, since we don't do any weird hackery or dynamism with the twisted.scripts package.

twisted-trac commented 10 years ago
tkanerva's avatar tkanerva commented

Replying to radix:

It's rather strange that you get an import error for twisted.scripts.trial -- it's simply a normal module that should exist as twisted/scripts/trial.py on your filesystem. Can you verify that it's actually there? If not, there's probably something wrong with the installation process. It'd be helpful to know what twisted.scripts.file and twisted.scripts.path are at run-time, for information-gathering purposes. There shouldn't be anything strange about them, since we don't do any weird hackery or dynamism with the twisted.scripts package.

I investigated this issue further today, and found out the following:

1) twisted/scripts has a non-empty init.py file, which does nontrivial things, and if I modify it to be empty, trial.py and other scripts can be imported.

2) the imports in that init.py themselves aren't probably the culprit, since I can add the imports there and it still works

3) adding the DeprecatedAttribute call from twisted.python.deprecate in init.py seems to be the root cause. I tried to dig deeper into deprecate.py and friends but could not isolate the issue further.

4) despite removing the deprecations from init.py trial still doesn't work properly - it cannot find the plugins necessary for reporter and/or reactor. Doing a --help-reporter gives an empty list, which is odd, since twisted.plugin gets imported correctly (verified that with debug prints).

twisted-trac commented 10 years ago
glyph's avatar @glyph commented

Replying to tkanerva:

Replying to radix:

3) adding the DeprecatedAttribute call from twisted.python.deprecate in init.py seems to be the root cause. I tried to dig deeper into deprecate.py and friends but could not isolate the issue further.

deprecatedModuleAttribute is definitely doing some pretty severe metaprogramming (expecting to be able to replace the currently-being-imported module object in sys.modules) so that's a good place to begin your investigation.

4) despite removing the deprecations from init.py trial still doesn't work properly - it cannot find the plugins necessary for reporter and/or reactor. Doing a --help-reporter gives an empty list, which is odd, since twisted.plugin gets imported correctly (verified that with debug prints).

Do the tests for twisted.python.modules work on jython?

twisted-trac commented 16 years ago
glyph's avatar @glyph commented

Signal module derived from one pasted at http://pylonshq.com/pasties/646 - copying it here because pastebins typically aren't permanent.

twisted-trac commented 15 years ago
thijstriemstra's avatar @thijstriemstra commented

The Jython buildbot is back up: http://buildbot.twistedmatrix.com/builders/ubuntu64-jython2.5-select/builds/19/steps/trial/logs/stdio

twisted-trac commented 15 years ago
vschiavoni's avatar vschiavoni commented

what is the exact steps to locally reproduce the error that is now stopping the buildbot (http://buildbot.twistedmatrix.com/builders/ubuntu64-jython2.5-select/builds/99) ? That is, which version to checkout ? which build tool can I execute ?

twisted-trac commented 15 years ago
vschiavoni's avatar vschiavoni commented

Currently, the build process fails due to a missing dependency toward jruby:

jython -v  setup.py install
import: 'exceptions' as org.python.core.exceptions in builtin modules
import: import site # precompiled from /Users/veleno/jython2.5b1/Lib/site$py.class
import: 'sys' as sys in builtin modules
import: import os # precompiled from /Users/veleno/jython2.5b1/Lib/os$py.class
import: 'errno' as org.python.modules.errno in builtin modules
import: 'jarray' as org.python.modules.jarray in builtin modules
import: 'java' as java package
import: 'System' as java class
import: 'time' as org.python.modules.time.Time in builtin modules
import: import stat # precompiled from /Users/veleno/jython2.5b1/Lib/stat$py.class
import: 'File' as java class
import: 'org' as java package
import: 'FileDescriptors' as java class
import: 'FileIO' as java class
import: 'IOBase' as java class
import: 'Py' as java class
import: 'Errno' as java class
import: 'JavaPOSIX' as java class
import: 'POSIXHandler' as java class
import: 'POSIXFactory' as java class
import: import posixpath # precompiled from /Users/veleno/jython2.5b1/Lib/posixpath$py.class
import: 'IOException' as java class
import: 'SecureRandom' as java class
import: 'FileDescriptor' as java class
import: import twisted # precompiled from ./twisted/__init__$py.class
import: import twisted.python # precompiled from ./twisted/python/__init__$py.class
import: import twisted.python.compat # precompiled from ./twisted/python/compat$py.class
import: import string # precompiled from /Users/veleno/jython2.5b1/Lib/string$py.class
import: import re # precompiled from /Users/veleno/jython2.5b1/Lib/re$py.class
import: import sre_compile # precompiled from /Users/veleno/jython2.5b1/Lib/sre_compile$py.class
import: '_sre' as org.python.modules._sre in builtin modules
import: import sre_constants # precompiled from /Users/veleno/jython2.5b1/Lib/sre_constants$py.class
import: import sre_parse # precompiled from /Users/veleno/jython2.5b1/Lib/sre_parse$py.class
import: import copy_reg # precompiled from /Users/veleno/jython2.5b1/Lib/copy_reg$py.class
import: import types # precompiled from /Users/veleno/jython2.5b1/Lib/types$py.class
import: import socket # precompiled from /Users/veleno/jython2.5b1/Lib/socket$py.class
import: 'struct' as org.python.modules.struct in builtin modules
import: import threading # precompiled from /Users/veleno/jython2.5b1/Lib/threading$py.class
import: 'InterruptedException' as java class
import: 'Collections' as java class
import: 'WeakHashMap' as java class
import: 'Semaphore' as java class
import: 'CyclicBarrier' as java class
import: 'ReentrantLock' as java class
import: 'jython' as java class
import: 'thread' as org.python.modules.thread.thread in builtin modules
import: 'Thread' as java class
import: import weakref # precompiled from /Users/veleno/jython2.5b1/Lib/weakref$py.class
import: import UserDict # precompiled from /Users/veleno/jython2.5b1/Lib/UserDict$py.class
import: '_weakref' as org.python.modules._weakref.WeakrefModule in builtin modules
import: import traceback # precompiled from /Users/veleno/jython2.5b1/Lib/traceback$py.class
import: import linecache # precompiled from /Users/veleno/jython2.5b1/Lib/linecache$py.class
import: import atexit # precompiled from /Users/veleno/jython2.5b1/Lib/atexit$py.class
import: 'BufferedInputStream' as java class
import: 'BufferedOutputStream' as java class
import: 'InterruptedIOException' as java class
import: 'String' as java class
import: 'Exception' as java class
import: 'DatagramPacket' as java class
import: 'InetAddress' as java class
import: 'InetSocketAddress' as java class
import: 'Socket' as java class
import: 'BindException' as java class
import: 'ConnectException' as java class
import: 'NoRouteToHostException' as java class
import: 'PortUnreachableException' as java class
import: 'ProtocolException' as java class
import: 'SocketException' as java class
import: 'SocketTimeoutException' as java class
import: 'UnknownHostException' as java class
import: 'ByteBuffer' as java class
import: 'DatagramChannel' as java class
import: 'ServerSocketChannel' as java class
import: 'SocketChannel' as java class
import: 'AlreadyConnectedException' as java class
import: 'AsynchronousCloseException' as java class
import: 'CancelledKeyException' as java class
import: 'ClosedByInterruptException' as java class
import: 'ClosedChannelException' as java class
import: 'ClosedSelectorException' as java class
import: 'ConnectionPendingException' as java class
import: 'IllegalBlockingModeException' as java class
import: 'IllegalSelectorException' as java class
import: 'NoConnectionPendingException' as java class
import: 'NonReadableChannelException' as java class
import: 'NonWritableChannelException' as java class
import: 'NotYetBoundException' as java class
import: 'NotYetConnectedException' as java class
import: 'UnresolvedAddressException' as java class
import: 'UnsupportedAddressTypeException' as java class
import: 'javax' as java package
import: 'SSLSocketFactory' as java class
import: 'DatagramSocketIO' as java class
import: 'ServerSocketIO' as java class
import: 'SocketIO' as java class
import: 'operator' as org.python.modules.operator in builtin modules
import: import twisted._version # precompiled from ./twisted/_version$py.class
import: import twisted.python.versions # precompiled from ./twisted/python/versions$py.class
import: import twisted.copyright # precompiled from ./twisted/copyright$py.class
import: import twisted.python.dist # precompiled from ./twisted/python/dist$py.class
import: import distutils # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/__init__$py.class
import: import distutils.command # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/__init__$py.class
import: import distutils.command.build_scripts # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/build_scripts$py.class
import: import distutils.sysconfig # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/sysconfig$py.class
import: import distutils.errors # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/errors$py.class
import: import distutils.core # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/core$py.class
import: import distutils.debug # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/debug$py.class
import: import distutils.util # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/util$py.class
import: import distutils.dep_util # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/dep_util$py.class
import: import distutils.spawn # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/spawn$py.class
import: import distutils.log # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/log$py.class
import: import distutils.dist # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/dist$py.class
import: import copy # precompiled from /Users/veleno/jython2.5b1/Lib/copy$py.class
import: 'PyStringMap' as java class
import: import warnings # precompiled from /Users/veleno/jython2.5b1/Lib/warnings$py.class
import: import distutils.fancy_getopt # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/fancy_getopt$py.class
import: import getopt # precompiled from /Users/veleno/jython2.5b1/Lib/getopt$py.class
import: import distutils.cmd # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/cmd$py.class
import: import distutils.dir_util # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/dir_util$py.class
import: import distutils.file_util # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/file_util$py.class
import: import distutils.archive_util # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/archive_util$py.class
import: import distutils.extension # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/extension$py.class
import: import distutils.command.install_data # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/install_data$py.class
import: import distutils.command.build_ext # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/build_ext$py.class
import: import distutils.command.build_py # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/build_py$py.class
import: import glob # precompiled from /Users/veleno/jython2.5b1/Lib/glob$py.class
import: import fnmatch # precompiled from /Users/veleno/jython2.5b1/Lib/fnmatch$py.class
import: import ConfigParser # precompiled from /Users/veleno/jython2.5b1/Lib/ConfigParser$py.class
import: import distutils.command.install # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/install$py.class
running install
import: import distutils.command.build # precompiled from /Users/veleno/jython2.5b1/Lib/distutils/command/build$py.class
running build
running build_py
copying twisted/_version.py -> build/lib/twisted
import: 'Integer' as java class
import: 'Long' as java class
Traceback (most recent call last):
  File "setup.py", line 97, in <module>
    main(sys.argv[1:])
  File "setup.py", line 97, in <module>
    main(sys.argv[1:])
  File "setup.py", line 92, in main
    setup(**setup_args)
  File "./twisted/python/dist.py", line 47, in setup
    return core.setup(**get_setup_args(**kw))
  File "/Users/veleno/jython2.5b1/Lib/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/Users/veleno/jython2.5b1/Lib/distutils/core.py", line 151, in setup
    dist.run_commands()
  File "/Users/veleno/jython2.5b1/Lib/distutils/dist.py", line 974, in run_commands
    self.run_command(cmd)
  File "/Users/veleno/jython2.5b1/Lib/distutils/dist.py", line 994, in run_command
    cmd_obj.run()
  File "/Users/veleno/jython2.5b1/Lib/distutils/command/install.py", line 513, in run
    self.run_command('build')
  File "/Users/veleno/jython2.5b1/Lib/distutils/cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "/Users/veleno/jython2.5b1/Lib/distutils/dist.py", line 994, in run_command
    cmd_obj.run()
  File "/Users/veleno/jython2.5b1/Lib/distutils/command/build.py", line 112, in run
    self.run_command(cmd_name)
  File "/Users/veleno/jython2.5b1/Lib/distutils/cmd.py", line 333, in run_command
    self.distribution.run_command(command)
  File "/Users/veleno/jython2.5b1/Lib/distutils/dist.py", line 994, in run_command
    cmd_obj.run()
  File "/Users/veleno/jython2.5b1/Lib/distutils/command/build_py.py", line 97, in run
    self.build_packages()
  File "/Users/veleno/jython2.5b1/Lib/distutils/command/build_py.py", line 415, in build_packages
    self.build_module(module, module_file, package)
  File "/Users/veleno/jython2.5b1/Lib/distutils/command/build_py.py", line 378, in build_module
    return self.copy_file(module_file, outfile, preserve_mode=0)
  File "/Users/veleno/jython2.5b1/Lib/distutils/cmd.py", line 371, in copy_file
    return file_util.copy_file(
  File "/Users/veleno/jython2.5b1/Lib/distutils/file_util.py", line 172, in copy_file
    os.utime(dst, (st[ST_ATIME], st[ST_MTIME]))
  File "/Users/veleno/jython2.5b1/Lib/os.py", line 557, in utime
    atimeval = _to_timeval(times[0])
  File "/Users/veleno/jython2.5b1/Lib/os.py", line 574, in _to_timeval
    from org.jruby.ext.posix.util import Platform
ImportError: No module named jruby
twisted-trac commented 15 years ago
thijstriemstra's avatar @thijstriemstra commented

Replying to glyph:

Signal module derived from one pasted at http://pylonshq.com/pasties/646 - copying it here because pastebins typically aren't permanent.

They added support for signals based on that module: http://bugs.jython.org/issue1074

The builder now fails with: http://buildbot.twistedmatrix.com/builders/ubuntu64-jython2.5-select/builds/102/steps/trial/logs/stdio

so we're one step closer :)

twisted-trac commented 15 years ago
thijstriemstra's avatar @thijstriemstra commented

Replying to vschiavoni:

Currently, the build process fails due to a missing dependency toward jruby:

I tried installing twisted 8.2 on the latest jython trunk (r5970) and it works great (no jruby errors here) but getting some UnicodeDecodeError:

byte-compiling build/bdist.java1.5.0_06/egg/twisted/words/test/test_xpath.py to test_xpath$py.class
byte-compiling build/bdist.java1.5.0_06/egg/twisted/words/test/test_domish.py to test_domish$py.class
byte-compiling build/bdist.java1.5.0_06/egg/twisted/words/test/test_jabberxmppstringprep.py to test_jabberxmppstringprep$py.class
Sorry: UnicodeDecodeError: ('unicodeescape', "u'\\udf42'", 2, 9, 'illegal Unicode character')
byte-compiling build/bdist.java1.5.0_06/egg/twisted/words/test/test_irc.py to test_irc$py.class
byte-compiling build/bdist.java1.5.0_06/egg/twisted/words/test/__init__.py to __init__$py.class
twisted-trac commented 15 years ago
thijstriemstra's avatar @thijstriemstra commented

Replying to thijs:

The builder now fails with: http://buildbot.twistedmatrix.com/builders/ubuntu64-jython2.5-select/builds/102/steps/trial/logs/stdio

Opened a Jython ticket for this issue.

twisted-trac commented 15 years ago
glyph's avatar @glyph commented

(In [26586]) Branching to 'jython-3413'

twisted-trac commented 15 years ago
glyph's avatar @glyph commented

I'm not intending to merge this branch; every fix here should be explained, tested, and merged separately. However, it's easier to smash the fixes together to push Jython as far along as possible to enumerate the other issues. Also, the Jython folks can run tests against this branch and their fix issues in advance of our patches.

twisted-trac commented 15 years ago
thijstriemstra's avatar @thijstriemstra commented

Added some more related tickets to this ticket description.

twisted-trac commented 15 years ago
thijstriemstra's avatar @thijstriemstra commented

adding more related tickets to the ticket description

twisted-trac commented 14 years ago
thijstriemstra's avatar @thijstriemstra commented

Our Jython buildslave is now failing with the following error:

Traceback (most recent call last):
  File "./bin/trial", line 22, in <module>
    run()
  File "/home/buildbot/Buildslaves/twisted/jython2.5-thijs-ubuntu/Twisted/twisted/scripts/trial.py", line 363, in run
    test_result = trialRunner.run(suite)
  File "/home/buildbot/Buildslaves/twisted/jython2.5-thijs-ubuntu/Twisted/twisted/trial/runner.py", line 833, in run
    return self._runWithoutDecoration(test)
  File "/home/buildbot/Buildslaves/twisted/jython2.5-thijs-ubuntu/Twisted/twisted/trial/runner.py", line 859, in _runWithoutDecoration
    oldDir = self._setUpTestdir()
  File "/home/buildbot/Buildslaves/twisted/jython2.5-thijs-ubuntu/Twisted/twisted/trial/runner.py", line 749, in _setUpTestdir
    if self._testDirLock.lock():
  File "/home/buildbot/Buildslaves/twisted/jython2.5-thijs-ubuntu/Twisted/twisted/python/lockfile.py", line 125, in lock
    symlink(str(os.getpid()), self.name)
  File "/home/buildbot/Buildslaves/twisted/jython2.5-thijs-ubuntu/Twisted/twisted/python/lockfile.py", line 125, in lock
    symlink(str(os.getpid()), self.name)
AttributeError: 'module' object has no attribute 'getpid'

Seems like a Jython issue to me so opened a ticket for them.

twisted-trac commented 14 years ago
thijstriemstra's avatar @thijstriemstra commented

Issue with ctypes/Jython is logged at http://bugs.jython.org/issue1554

twisted-trac commented 14 years ago
thijstriemstra's avatar @thijstriemstra commented

fyi, created http://wiki.python.org/jython/TwistedOnJython linking to this ticket.

twisted-trac commented 14 years ago
therve's avatar @therve commented

Thijs: is there a plan to get the buildbot slave back? Progress will stale otherwise.