Skip to content
This repository has been archived by the owner on Dec 17, 2020. It is now read-only.

Commit

Permalink
Work on PyPI - currently not working, see ankitects/anki#535 (comment)
Browse files Browse the repository at this point in the history
  • Loading branch information
agentydragon committed Apr 20, 2020
1 parent a3ba229 commit 62c672e
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 9 deletions.
28 changes: 21 additions & 7 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -28,20 +28,33 @@ load("@io_bazel_rules_sass//sass:sass_repositories.bzl", "sass_repositories")

sass_repositories()

# Python rules

http_archive(
# NOTE: cannot use version 0.0.1 as it doesn't support Python 3 pip packages.
git_repository(
name = "rules_python",
sha256 = "aa96a691d3a8177f3215b14b0edc9641787abaaa30363a080165d06ab65e1161",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.0.1/rules_python-0.0.1.tar.gz",
# NOT VALID: Replace with actual Git commit SHA.
commit = "a0fbf98d4e3a232144df4d0d80b577c7a693b570",
remote = "https://github.com/bazelbuild/rules_python.git",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

# Only needed if using the packaging rules.
# load("@rules_python//python:pip.bzl", "pip_repositories")
# pip_repositories()
#load("@rules_python//python:pip.bzl", "pip_import", "pip_repositories")
load("@rules_python//python:pip.bzl", "pip_import", "pip_repositories")

pip_repositories()

pip_import(
name = "my_deps",
python_interpreter = "python3",
requirements = "//src:requirements.txt",
)

load("@my_deps//:requirements.bzl", "pip_install")

pip_install()

node_repositories(package_json = ["//:package.json"])

Expand Down Expand Up @@ -94,4 +107,5 @@ http_archive(
load("@io_bazel_rules_closure//closure:repositories.bzl", "rules_closure_dependencies", "rules_closure_toolchains")

rules_closure_dependencies()

rules_closure_toolchains()
6 changes: 5 additions & 1 deletion src/deploy/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
load("@rules_python//python:defs.bzl", "py_binary")
load("@my_deps//:requirements.bzl", "requirement")

py_binary(
name = "build_slug",
Expand All @@ -10,7 +11,10 @@ py_binary(
name = "list_models",
srcs = ["list_models.py"],
data = ["//src/models:slug.json"],
deps = ["@rules_python//python/runfiles"],
deps = [
"@rules_python//python/runfiles",
requirement("anki2"),
],
)

py_binary(
Expand Down
2 changes: 1 addition & 1 deletion src/deploy/list_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
import json
import sys

sys.path.append('/usr/share/anki')
# From anki2 package.
import anki

flags.DEFINE_string('collection_path', None, 'Path to .anki2 collection')
Expand Down
1 change: 1 addition & 0 deletions src/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
anki2

0 comments on commit 62c672e

Please sign in to comment.