lol
1{ stdenv, fetchurl, python }:
2
3let
4 pythonEnv = python.withPackages(ps: [ps.Pyro]);
5in stdenv.mkDerivation rec {
6 name = "openopc-${version}";
7 version = "1.2.0";
8
9 src = fetchurl {
10 url = "mirror://sourceforge/project/openopc/openopc/${version}/OpenOPC-${version}.source.tar.bz2";
11 sha256 = "0mm77fiipz5zy82l6pr3wk18bfril81milv2rdxr954c4gw5smyd";
12 };
13
14 # There is no setup.py or any other "build system" file in the source archive.
15 installPhase = ''
16 mkdir -p "$out/bin"
17 mkdir -p "$out/share/doc/openopc"
18 mkdir -p "$out/${pythonEnv.python.sitePackages}"
19 mkdir -p "$out/libexec/opc"
20
21 cp src/OpenOPC.py "$out/${pythonEnv.python.sitePackages}"
22 cp src/opc.py "$out/libexec/opc/"
23
24 cat > "$out/bin/opc" << __EOF__
25 #!${stdenv.shell}
26 export PYTHONPATH="$out/${pythonEnv.python.sitePackages}"
27 exec ${pythonEnv}/bin/${pythonEnv.python.executable} "$out/libexec/opc/opc.py" "\$@"
28 __EOF__
29 chmod a+x "$out/bin/opc"
30
31 cp -R *.txt doc/* "$out/share/doc/openopc/"
32
33 # Copy these MS Windows tools, for reference.
34 cp src/OpenOPCService.py src/SystemHealth.py "$out/libexec/opc/"
35 '';
36
37 meta = with stdenv.lib; {
38 description = "OPC (OLE for Process Control) toolkit designed for use with Python";
39 homepage = http://openopc.sourceforge.net/;
40 # """OpenOPC for Python is freely available under the terms of the GNU GPL.
41 # However, the OpenOPC library module is licensed under the "GPL + linking
42 # exception" license, which generally means that programs written using the
43 # OpenOPC library may be licensed under any terms."""
44 license = licenses.gpl2;
45 platforms = platforms.linux;
46 maintainers = [ maintainers.bjornfor ];
47 };
48}