Merge remote-tracking branch 'upstream/master' into staging
This commit is contained in:
@@ -1,13 +1,12 @@
|
||||
{ stdenv, lib, writeText, buildPythonPackage, fetchPypi, libpcap, dpkt }:
|
||||
{ lib, writeText, buildPythonPackage, fetchPypi, libpcap, dpkt }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "pypcap";
|
||||
version = "1.2.1";
|
||||
name = "${pname}-${version}";
|
||||
version = "1.2.2";
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "9ca9f79ca839fdc8fd37393509e2cb06be70f8db03f8cfe1857ca40cac1149f0";
|
||||
sha256 = "07ww25z4xydp11hb38halh1940gmp5lca11hwfb63zv3bps248x3";
|
||||
};
|
||||
|
||||
patches = [
|
||||
@@ -17,26 +16,24 @@ buildPythonPackage rec {
|
||||
''
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -27,7 +27,8 @@ def recursive_search(path, target_files):
|
||||
@@ -28,6 +28,7 @@ def recursive_search(path, target_files):
|
||||
|
||||
def get_extension():
|
||||
# A list of all the possible search directories
|
||||
- dirs = ['/usr', sys.prefix] + glob.glob('/opt/libpcap*') + \
|
||||
+ dirs = ['${libpcap}', '/usr', sys.prefix] + \
|
||||
+ glob.glob('/opt/libpcap*') + \
|
||||
glob.glob('../libpcap*') + glob.glob('../wpdpack*') + \
|
||||
glob.glob('/Applications/Xcode.app/Contents/Developer/Platforms/' +
|
||||
'MacOSX.platform/Developer/SDKs/*')
|
||||
def find_prefix_and_pcap_h():
|
||||
prefixes = chain.from_iterable((
|
||||
+ '${libpcap}',
|
||||
('/usr', sys.prefix),
|
||||
glob.glob('/opt/libpcap*'),
|
||||
glob.glob('../libpcap*'),
|
||||
'')
|
||||
];
|
||||
|
||||
buildInputs = [ libpcap ];
|
||||
nativeBuildInputs = [ dpkt ];
|
||||
checkInputs = [ dpkt ];
|
||||
|
||||
meta = {
|
||||
meta = with lib; {
|
||||
homepage = https://github.com/pynetwork/pypcap;
|
||||
description = "Simplified object-oriented Python wrapper for libpcap";
|
||||
license = lib.licenses.bsd3;
|
||||
maintainers = with lib.maintainers; [ geistesk ];
|
||||
license = licenses.bsd3;
|
||||
maintainers = with maintainers; [ geistesk ];
|
||||
};
|
||||
}
|
||||
|
||||
119
pkgs/development/python-modules/pysdl2/PySDL2-dll.patch
Normal file
119
pkgs/development/python-modules/pysdl2/PySDL2-dll.patch
Normal file
@@ -0,0 +1,119 @@
|
||||
diff -ru PySDL2-0.9.6-old/sdl2/dll.py PySDL2-0.9.6/sdl2/dll.py
|
||||
--- PySDL2-0.9.6-old/sdl2/dll.py 2018-03-08 10:18:37.583471745 +0100
|
||||
+++ PySDL2-0.9.6/sdl2/dll.py 2018-03-08 10:20:06.705517520 +0100
|
||||
@@ -45,29 +45,31 @@
|
||||
"""Function wrapper around the different DLL functions. Do not use or
|
||||
instantiate this one directly from your user code.
|
||||
"""
|
||||
- def __init__(self, libinfo, libnames, path=None):
|
||||
- self._dll = None
|
||||
- foundlibs = _findlib(libnames, path)
|
||||
- dllmsg = "PYSDL2_DLL_PATH: %s" % (os.getenv("PYSDL2_DLL_PATH") or "unset")
|
||||
- if len(foundlibs) == 0:
|
||||
- raise RuntimeError("could not find any library for %s (%s)" %
|
||||
- (libinfo, dllmsg))
|
||||
- for libfile in foundlibs:
|
||||
- try:
|
||||
- self._dll = CDLL(libfile)
|
||||
- self._libfile = libfile
|
||||
- break
|
||||
- except Exception as exc:
|
||||
- # Could not load the DLL, move to the next, but inform the user
|
||||
- # about something weird going on - this may become noisy, but
|
||||
- # is better than confusing the users with the RuntimeError below
|
||||
- warnings.warn(repr(exc), DLLWarning)
|
||||
- if self._dll is None:
|
||||
- raise RuntimeError("found %s, but it's not usable for the library %s" %
|
||||
- (foundlibs, libinfo))
|
||||
- if path is not None and sys.platform in ("win32",) and \
|
||||
- path in self._libfile:
|
||||
- os.environ["PATH"] = "%s;%s" % (path, os.environ["PATH"])
|
||||
+ def __init__(self, libfile):
|
||||
+ self._dll = CDLL(libfile)
|
||||
+ self._libfile = libfile
|
||||
+ # self._dll = None
|
||||
+ # foundlibs = _findlib(libnames, path)
|
||||
+ # dllmsg = "PYSDL2_DLL_PATH: %s" % (os.getenv("PYSDL2_DLL_PATH") or "unset")
|
||||
+ # if len(foundlibs) == 0:
|
||||
+ # raise RuntimeError("could not find any library for %s (%s)" %
|
||||
+ # (libinfo, dllmsg))
|
||||
+ # for libfile in foundlibs:
|
||||
+ # try:
|
||||
+ # self._dll = CDLL(libfile)
|
||||
+ # self._libfile = libfile
|
||||
+ # break
|
||||
+ # except Exception as exc:
|
||||
+ # # Could not load the DLL, move to the next, but inform the user
|
||||
+ # # about something weird going on - this may become noisy, but
|
||||
+ # # is better than confusing the users with the RuntimeError below
|
||||
+ # warnings.warn(repr(exc), DLLWarning)
|
||||
+ # if self._dll is None:
|
||||
+ # raise RuntimeError("found %s, but it's not usable for the library %s" %
|
||||
+ # (foundlibs, libinfo))
|
||||
+ # if path is not None and sys.platform in ("win32",) and \
|
||||
+ # path in self._libfile:
|
||||
+ # os.environ["PATH"] = "%s;%s" % (path, os.environ["PATH"])
|
||||
|
||||
def bind_function(self, funcname, args=None, returns=None, optfunc=None):
|
||||
"""Binds the passed argument and return value types to the specified
|
||||
@@ -110,7 +112,7 @@
|
||||
return
|
||||
|
||||
try:
|
||||
- dll = DLL("SDL2", ["SDL2", "SDL2-2.0"], os.getenv("PYSDL2_DLL_PATH"))
|
||||
+ dll = DLL("SDL2")
|
||||
except RuntimeError as exc:
|
||||
raise ImportError(exc)
|
||||
|
||||
diff -ru PySDL2-0.9.6-old/sdl2/sdlgfx.py PySDL2-0.9.6/sdl2/sdlgfx.py
|
||||
--- PySDL2-0.9.6-old/sdl2/sdlgfx.py 2018-03-08 10:18:37.585471769 +0100
|
||||
+++ PySDL2-0.9.6/sdl2/sdlgfx.py 2018-03-08 10:20:06.705517520 +0100
|
||||
@@ -34,8 +34,7 @@
|
||||
]
|
||||
|
||||
try:
|
||||
- dll = DLL("SDL2_gfx", ["SDL2_gfx", "SDL2_gfx-1.0"],
|
||||
- os.getenv("PYSDL2_DLL_PATH"))
|
||||
+ dll = DLL("SDL2_gfx")
|
||||
except RuntimeError as exc:
|
||||
raise ImportError(exc)
|
||||
|
||||
diff -ru PySDL2-0.9.6-old/sdl2/sdlimage.py PySDL2-0.9.6/sdl2/sdlimage.py
|
||||
--- PySDL2-0.9.6-old/sdl2/sdlimage.py 2018-03-08 10:18:37.585471769 +0100
|
||||
+++ PySDL2-0.9.6/sdl2/sdlimage.py 2018-03-08 10:20:06.705517520 +0100
|
||||
@@ -26,8 +26,7 @@
|
||||
]
|
||||
|
||||
try:
|
||||
- dll = DLL("SDL2_image", ["SDL2_image", "SDL2_image-2.0"],
|
||||
- os.getenv("PYSDL2_DLL_PATH"))
|
||||
+ dll = DLL("SDL2_image")
|
||||
except RuntimeError as exc:
|
||||
raise ImportError(exc)
|
||||
|
||||
diff -ru PySDL2-0.9.6-old/sdl2/sdlmixer.py PySDL2-0.9.6/sdl2/sdlmixer.py
|
||||
--- PySDL2-0.9.6-old/sdl2/sdlmixer.py 2018-03-08 10:18:37.585471769 +0100
|
||||
+++ PySDL2-0.9.6/sdl2/sdlmixer.py 2018-03-08 10:20:27.415758478 +0100
|
||||
@@ -50,8 +50,7 @@
|
||||
]
|
||||
|
||||
try:
|
||||
- dll = DLL("SDL2_mixer", ["SDL2_mixer", "SDL2_mixer-2.0"],
|
||||
- os.getenv("PYSDL2_DLL_PATH"))
|
||||
+ dll = DLL("SDL2_mixer")
|
||||
except RuntimeError as exc:
|
||||
raise ImportError(exc)
|
||||
|
||||
diff -ru PySDL2-0.9.6-old/sdl2/sdlttf.py PySDL2-0.9.6/sdl2/sdlttf.py
|
||||
--- PySDL2-0.9.6-old/sdl2/sdlttf.py 2018-03-08 10:18:37.585471769 +0100
|
||||
+++ PySDL2-0.9.6/sdl2/sdlttf.py 2018-03-08 10:20:06.705517520 +0100
|
||||
@@ -38,8 +38,7 @@
|
||||
]
|
||||
|
||||
try:
|
||||
- dll = DLL("SDL2_ttf", ["SDL2_ttf", "SDL2_ttf-2.0"],
|
||||
- os.getenv("PYSDL2_DLL_PATH"))
|
||||
+ dll = DLL("SDL2_ttf")
|
||||
except RuntimeError as exc:
|
||||
raise ImportError(exc)
|
||||
|
||||
41
pkgs/development/python-modules/pysdl2/default.nix
Normal file
41
pkgs/development/python-modules/pysdl2/default.nix
Normal file
@@ -0,0 +1,41 @@
|
||||
{ stdenv, lib, fetchPypi, buildPythonPackage, fetchurl, SDL2, SDL2_ttf, SDL2_image, SDL2_gfx, SDL2_mixer, pyopengl }:
|
||||
|
||||
buildPythonPackage rec {
|
||||
pname = "PySDL2";
|
||||
version = "0.9.6";
|
||||
# The tests use OpenGL using find_library, which would have to be
|
||||
# patched; also they seem to actually open X windows and test stuff
|
||||
# like "screensaver disabling", which would have to be cleverly
|
||||
# sandboxed. Disable for now.
|
||||
doCheck = false;
|
||||
|
||||
src = fetchPypi {
|
||||
inherit pname version;
|
||||
sha256 = "08r1v9wdq8pzds4g3sng2xgh1hlzfs2z7qgy5a6b0xrs96swlamm";
|
||||
};
|
||||
|
||||
# Deliberately not in propagated build inputs; users can decide
|
||||
# which library they want to include.
|
||||
buildInputs = [ SDL2_ttf SDL2_image SDL2_gfx SDL2_mixer ];
|
||||
propagatedBuildInputs = [ SDL2 ];
|
||||
patches = [ ./PySDL2-dll.patch ];
|
||||
postPatch = ''
|
||||
substituteInPlace sdl2/dll.py --replace \
|
||||
"DLL(\"SDL2\")" "DLL('${SDL2}/lib/libSDL2${stdenv.hostPlatform.extensions.sharedLibrary}')"
|
||||
substituteInPlace sdl2/sdlttf.py --replace \
|
||||
"DLL(\"SDL2_ttf\")" "DLL('${SDL2_ttf}/lib/libSDL2_ttf${stdenv.hostPlatform.extensions.sharedLibrary}')"
|
||||
substituteInPlace sdl2/sdlimage.py --replace \
|
||||
"DLL(\"SDL2_image\")" "DLL('${SDL2_image}/lib/libSDL2_image${stdenv.hostPlatform.extensions.sharedLibrary}')"
|
||||
substituteInPlace sdl2/sdlgfx.py --replace \
|
||||
"DLL(\"SDL2_gfx\")" "DLL('${SDL2_gfx}/lib/libSDL2_gfx${stdenv.hostPlatform.extensions.sharedLibrary}')"
|
||||
substituteInPlace sdl2/sdlmixer.py --replace \
|
||||
"DLL(\"SDL2_mixer\")" "DLL('${SDL2_mixer}/lib/libSDL2_mixer${stdenv.hostPlatform.extensions.sharedLibrary}')"
|
||||
'';
|
||||
|
||||
meta = {
|
||||
description = "A wrapper around the SDL2 library and as such similar to the discontinued PySDL project";
|
||||
homepage = https://github.com/marcusva/py-sdl2;
|
||||
license = lib.licenses.publicDomain;
|
||||
maintainers = with lib.maintainers; [ pmiddend ];
|
||||
};
|
||||
}
|
||||
Reference in New Issue
Block a user