Last active
December 24, 2015 00:29
-
-
Save jimbaker/6717525 to your computer and use it in GitHub Desktop.
clamped - setup.py for a project using clamp
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# clamped/clamped/__init__.py | |
import java | |
from java.io import Serializable | |
from java.util.concurrent import Callable | |
from clamp import ClampProxyMaker | |
class BarClamp(Callable, Serializable): | |
__proxymaker__ = ClampProxyMaker( | |
"bar", | |
constants={ "fortytwo": (java.lang.Integer(42), java.lang.Integer.TYPE), | |
"str": ("A string", java.lang.String), | |
"serialVersionUID" : (java.lang.Long(99), java.lang.Long.TYPE), | |
}) | |
def __init__(self): | |
print "Being init-ed", self | |
def call(self): | |
print "foo" | |
return 42 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#clamped/setup.py | |
import ez_setup | |
ez_setup.use_setuptools() | |
from setuptools import setup, find_packages | |
setup( | |
name = "clamped", | |
version = "0.1", | |
packages = find_packages(), | |
install_requires = ["clamp>=0.1"], | |
clamp = ["clamped"], | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// put this wherever you want - just need to ensure that the clamped-0.1.jar is on the CLASSPATH (or otherwise available) | |
// for both Python and Java | |
import bar.clamped.BarClamp; | |
public class UseClamped { | |
public static void main(String[] args) { | |
BarClamp barclamp = new BarClamp(); | |
try { | |
System.out.println("BarClamp: " + barclamp.call()); | |
} catch (Exception ex) { | |
System.err.println("Exception: " + ex); | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment