pysc2: init at 1.2
This commit is contained in:
parent
bdce7d3a04
commit
6a70e7f7c8
64
pkgs/development/python-modules/pysc2/default.nix
Normal file
64
pkgs/development/python-modules/pysc2/default.nix
Normal file
@ -0,0 +1,64 @@
|
||||
{ buildPythonPackage
|
||||
, lib
|
||||
, fetchFromGitHub
|
||||
, absl-py
|
||||
, enum34
|
||||
, future
|
||||
, futures
|
||||
, mock
|
||||
, mpyq
|
||||
, numpy
|
||||
, portpicker
|
||||
, protobuf
|
||||
, pygame
|
||||
, s2clientprotocol
|
||||
, six
|
||||
, websocket_client
|
||||
, sc2-headless
|
||||
}:
|
||||
|
||||
buildPythonPackage rec {
|
||||
version = "1.2";
|
||||
name = "PySC2-${version}";
|
||||
|
||||
src = fetchFromGitHub {
|
||||
owner = "deepmind";
|
||||
repo = "pysc2";
|
||||
rev = "39f84b01d662eb58b3d95791f59208c210afd4e7";
|
||||
sha256 = "0dfbc2krd2rys1ji75ng2nl0ki8nhnylxljcp287bfb8qyz2m25p";
|
||||
};
|
||||
|
||||
patches = [
|
||||
./fix-setup-for-py3.patch
|
||||
./parameterize-runconfig-sc2path.patch
|
||||
];
|
||||
|
||||
postPatch = ''
|
||||
substituteInPlace "./pysc2/run_configs/platforms.py" \
|
||||
--subst-var-by 'sc2path' '${sc2-headless}'
|
||||
'';
|
||||
|
||||
propagatedBuildInputs = [
|
||||
absl-py
|
||||
enum34
|
||||
future
|
||||
mock
|
||||
mpyq
|
||||
numpy
|
||||
portpicker
|
||||
protobuf
|
||||
pygame
|
||||
s2clientprotocol
|
||||
six
|
||||
websocket_client
|
||||
sc2-headless
|
||||
];
|
||||
|
||||
meta = {
|
||||
description = "Starcraft II environment and library for training agents.";
|
||||
homepage = "https://github.com/deepmind/pysc2";
|
||||
license = lib.licenses.asl20;
|
||||
platforms = lib.platforms.linux;
|
||||
maintainers = with lib.maintainers; [ danharaj ];
|
||||
};
|
||||
}
|
@ -0,0 +1,64 @@
|
||||
diff --git a/setup.py b/setup.py
|
||||
index 020768f..13c2b67 100755
|
||||
--- a/setup.py
|
||||
+++ b/setup.py
|
||||
@@ -17,6 +17,8 @@ from __future__ import absolute_import
|
||||
from __future__ import division
|
||||
from __future__ import print_function
|
||||
|
||||
+import sys
|
||||
+
|
||||
from setuptools import setup
|
||||
|
||||
description = """PySC2 - StarCraft II Learning Environment
|
||||
@@ -36,6 +38,27 @@ some initial research results using the environment.
|
||||
Read the README at https://github.com/deepmind/pysc2 for more information.
|
||||
"""
|
||||
|
||||
+requires = [
|
||||
+ 'absl-py>=0.1.0',
|
||||
+ 'future',
|
||||
+ 'mock',
|
||||
+ 'mpyq',
|
||||
+ 'numpy>=1.10',
|
||||
+ 'portpicker>=1.2.0',
|
||||
+ 'protobuf>=2.6',
|
||||
+ 'pygame',
|
||||
+ 's2clientprotocol>=3.19.0.58400.0',
|
||||
+ 'six',
|
||||
+ 'websocket-client',
|
||||
+]
|
||||
+
|
||||
+if sys.version_info[0] == 2:
|
||||
+ requires.append('futures')
|
||||
+
|
||||
+if (sys.version_info[0] == 2
|
||||
+ or (sys.version_info[0] == 3 and sys.version_info[1] < 4)):
|
||||
+ requires.append('enum34')
|
||||
+
|
||||
setup(
|
||||
name='PySC2',
|
||||
version='1.2',
|
||||
@@ -56,21 +79,7 @@ setup(
|
||||
'pysc2.run_configs',
|
||||
'pysc2.tests',
|
||||
],
|
||||
- install_requires=[
|
||||
- 'absl-py>=0.1.0',
|
||||
- 'enum34',
|
||||
- 'future',
|
||||
- 'futures',
|
||||
- 'mock',
|
||||
- 'mpyq',
|
||||
- 'numpy>=1.10',
|
||||
- 'portpicker>=1.2.0',
|
||||
- 'protobuf>=2.6',
|
||||
- 'pygame',
|
||||
- 's2clientprotocol>=3.19.0.58400.0',
|
||||
- 'six',
|
||||
- 'websocket-client',
|
||||
- ],
|
||||
+ install_requires=requires,
|
||||
entry_points={
|
||||
'console_scripts': [
|
||||
'pysc2_agent = pysc2.bin.agent:entry_point',
|
@ -0,0 +1,18 @@
|
||||
diff --git a/pysc2/run_configs/platforms.py b/pysc2/run_configs/platforms.py
|
||||
index 5cd84f9..1923cb7 100644
|
||||
--- a/pysc2/run_configs/platforms.py
|
||||
+++ b/pysc2/run_configs/platforms.py
|
||||
@@ -119,12 +119,9 @@ class Linux(LocalBase):
|
||||
"""Config to run on Linux."""
|
||||
|
||||
def __init__(self):
|
||||
- base_dir = os.environ.get("SC2PATH", "~/StarCraftII")
|
||||
+ base_dir = os.environ.get("SC2PATH", "@sc2path@")
|
||||
base_dir = os.path.expanduser(base_dir)
|
||||
env = copy.deepcopy(os.environ)
|
||||
- env["LD_LIBRARY_PATH"] = ":".join(filter(None, [
|
||||
- os.environ.get("LD_LIBRARY_PATH"),
|
||||
- os.path.join(base_dir, "Libs/")]))
|
||||
super(Linux, self).__init__(base_dir, "SC2_x64", env=env)
|
||||
|
||||
@classmethod
|
@ -270,6 +270,8 @@ in {
|
||||
pythonPackages = self;
|
||||
};
|
||||
|
||||
pysc2 = callPackage ../development/python-modules/pysc2 { };
|
||||
|
||||
pyscard = callPackage ../development/python-modules/pyscard { inherit (pkgs.darwin.apple_sdk.frameworks) PCSC; };
|
||||
|
||||
pyside = callPackage ../development/python-modules/pyside { };
|
||||
|
Loading…
Reference in New Issue
Block a user