From 183c96e60330f58239bb375f1950de5be9663b96 Mon Sep 17 00:00:00 2001 From: mavenlin Date: Wed, 6 Dec 2023 17:50:25 +0800 Subject: [PATCH] further fix windows --- gen_repo/gen_py.py | 4 ++-- gen_repo/libxc/build.jinja | 1 + gen_repo/wheel.BUILD | 6 ++++-- 3 files changed, 7 insertions(+), 4 deletions(-) diff --git a/gen_repo/gen_py.py b/gen_repo/gen_py.py index cb1184d..23f1020 100644 --- a/gen_repo/gen_py.py +++ b/gen_repo/gen_py.py @@ -87,10 +87,10 @@ def main(_): functionals.append((p, ext_params, ext_params_descriptions, info)) - with open(FLAGS.template, "rt") as f: + with open(FLAGS.template, "rt", encoding="utf8") as f: py_template = Template(f.read(), trim_blocks=True, lstrip_blocks=True) py_code = py_template.render(functionals=functionals, zip=zip) - with open(FLAGS.output, "wt") as out: + with open(FLAGS.output, "wt", encoding="utf8") as out: out.write(py_code) diff --git a/gen_repo/libxc/build.jinja b/gen_repo/libxc/build.jinja index 1738ef7..9c11ff8 100644 --- a/gen_repo/libxc/build.jinja +++ b/gen_repo/libxc/build.jinja @@ -110,6 +110,7 @@ genrule( srcs = [":libxc.so"], outs = ["libxc.pyd"], cmd = "cp $< $@", + visibility = ["//visibility:public"], ) py_library( diff --git a/gen_repo/wheel.BUILD b/gen_repo/wheel.BUILD index 157e5b1..89a8180 100644 --- a/gen_repo/wheel.BUILD +++ b/gen_repo/wheel.BUILD @@ -68,6 +68,8 @@ py_wheel( "@jax_xc_repo//jax_xc:utils", "@jax_xc_repo//jax_xc/impl", "@jax_xc_repo//jax_xc/libxc", - "@jax_xc_repo//jax_xc/libxc:libxc.so", - ], + ] + select({ + "@platforms//os:windows": ["@jax_xc_repo//jax_xc/libxc:gen_pyd"], + "//conditions:default": ["@jax_xc_repo//jax_xc/libxc:libxc.so"], + }), )