1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-11-23 06:01:15 +00:00

Merge pull request #30552 from obsidiansystems/pysc2-init

pysc2: init at 1.2
This commit is contained in:
Frederik Rietdijk 2017-11-14 21:24:49 +01:00 committed by GitHub
commit 0cedba16b8
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
12 changed files with 285 additions and 1 deletions

View file

@ -145,6 +145,7 @@
DamienCassou = "Damien Cassou <damien@cassou.me>";
danbst = "Danylo Hlynskyi <abcz2.uprola@gmail.com>";
dancek = "Hannu Hartikainen <hannu.hartikainen@gmail.com>";
danharaj = "Dan Haraj <dan@obsidian.systems>";
danielfullmer = "Daniel Fullmer <danielrf12@gmail.com>";
dasuxullebt = "Christoph-Simon Senjak <christoph.senjak@googlemail.com>";
david50407 = "David Kuo <me@davy.tw>";

View file

@ -1,4 +1,5 @@
{ stdenv
, callPackage
, lib
, fetchurl
, unzip
@ -11,7 +12,8 @@ if !licenseAccepted then throw ''
by setting nixpkgs config option 'sc2-headless.accept_license = true;'
''
else assert licenseAccepted;
stdenv.mkDerivation rec {
let maps = callPackage ./maps.nix {};
in stdenv.mkDerivation rec {
version = "3.17";
name = "sc2-headless-${version}";
@ -30,6 +32,8 @@ stdenv.mkDerivation rec {
mkdir -p $out
cp -r . "$out"
rm -r $out/Libs
cp -r "${maps.minigames}"/* "$out"/Maps/
'';
preFixup = ''
@ -50,5 +54,6 @@ stdenv.mkDerivation rec {
url = "https://blzdistsc2-a.akamaihd.net/AI_AND_MACHINE_LEARNING_LICENSE.html";
free = false;
};
maintainers = with lib.maintainers; [ danharaj ];
};
}

View file

@ -0,0 +1,11 @@
{ fetchzip
}:
{
minigames = fetchzip {
url = "https://github.com/deepmind/pysc2/releases/download/v1.2/mini_games.zip";
sha256 = "19f873ilcdsf50g2v0s2zzmxil1bqncsk8nq99bzy87h0i7khkla";
stripRoot = false;
};
}

View file

@ -0,0 +1,28 @@
{ buildPythonPackage
, lib
, fetchPypi
, six
}:
buildPythonPackage rec {
pname = "absl-py";
version = "0.1.3";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "017wc85i7l3vpjzw3shgb7k7n0jfid88g09dlf1kgdy4ll0sjfax";
};
propagatedBuildInputs = [ six ];
# checks use bazel; should be revisited
doCheck = false;
meta = {
description = "Abseil Python Common Libraries";
homepage = "https://github.com/abseil/abseil-py";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ danharaj ];
};
}

View file

@ -0,0 +1,22 @@
{ buildPythonPackage
, lib
, fetchPypi
}:
buildPythonPackage rec {
pname = "mpyq";
version = "0.2.5";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "01q0xh2fy3zzsrfr45d2ypj4whs7s060cy1rnprg6sg55fbgbaih";
};
meta = {
description = "A Python library for extracting MPQ (MoPaQ) files.";
homepage = "https://github.com/eagleflo/mpyq";
license = lib.licenses.bsd2;
maintainers = with lib.maintainers; [ danharaj ];
};
}

View file

@ -0,0 +1,22 @@
{ buildPythonPackage
, lib
, fetchPypi
}:
buildPythonPackage rec {
pname = "portpicker";
version = "1.2.0";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "0c1lm3i4yngi1qclb0hny19vwjd2si5k2qni30wcrnxqqasqak1y";
};
meta = {
description = "A library to choose unique available network ports.";
homepage = "https://github.com/google/python_portpicker";
license = lib.licenses.asl20;
maintainers = with lib.maintainers; [ danharaj ];
};
}

View 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 ];
};
}

View file

@ -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',

View file

@ -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

View file

@ -0,0 +1,27 @@
{ buildPythonPackage
, lib
, fetchPypi
, protobuf
}:
buildPythonPackage rec {
pname = "s2clientprotocol";
version = "3.19.1.58600.0";
name = "${pname}-${version}";
src = fetchPypi {
inherit pname version;
sha256 = "02jqwdfj5zpag4c5nf0707qmwk7sqm98yfgrd19rq6pi58zgl74f";
};
patches = [ ./pure-version.patch ];
buildInputs = [ protobuf ];
meta = {
description = "StarCraft II - client protocol.";
homepage = "https://github.com/Blizzard/sc2client-proto";
license = lib.licenses.mit;
maintainers = with lib.maintainers; [ danharaj ];
};
}

View file

@ -0,0 +1,13 @@
diff --git a/setup.py b/setup.py
index 89131a8..19527df 100755
--- a/setup.py
+++ b/setup.py
@@ -13,8 +13,6 @@ from distutils.spawn import find_executable
from setuptools import setup
from setuptools.command.build_py import build_py
-import gameversion_autogen as ver
-
SETUP_DIR = os.path.dirname(os.path.abspath(__file__))
PROTO_DIR = os.path.join(SETUP_DIR, 's2clientprotocol')

View file

@ -106,6 +106,8 @@ in {
# Left for backwards compatibility
"3to2" = self.py3to2;
absl-py = callPackage ../development/python-modules/absl-py { };
aenum = callPackage ../development/python-modules/aenum { };
affinity = callPackage ../development/python-modules/affinity { };
@ -268,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 { };
@ -3321,6 +3325,8 @@ in {
};
};
mpyq = callPackage ../development/python-modules/mpyq { };
mxnet = buildPythonPackage rec {
inherit (pkgs.mxnet) name version src meta;
@ -3341,6 +3347,8 @@ in {
'';
};
portpicker = callPackage ../development/python-modules/portpicker { };
pkginfo = buildPythonPackage rec {
version = "1.3.2";
name = "pkginfo-${version}";
@ -7178,6 +7186,7 @@ in {
meta.broken = true; # Tests fail, and no reverse-dependencies anyway
};
s2clientprotocol = callPackage ../development/python-modules/s2clientprotocol { };
statsd = buildPythonPackage rec {
name = "statsd-${version}";