Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
C
cython
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Labels
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Commits
Open sidebar
nexedi
cython
Commits
8901b249
Commit
8901b249
authored
Sep 16, 2016
by
Robert Bradshaw
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Expand bazel example.
parent
ee3bd4d9
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
8 additions
and
3 deletions
+8
-3
Tools/rules.bzl
Tools/rules.bzl
+8
-3
No files found.
Tools/rules.bzl
View file @
8901b249
...
@@ -5,14 +5,18 @@ Uses Cython to compile a .pyx files (and .py files with corresponding .pxd
...
@@ -5,14 +5,18 @@ Uses Cython to compile a .pyx files (and .py files with corresponding .pxd
files) to Python extension modules.
files) to Python extension modules.
Example:
Example:
# Assuming Cython is mapped to "cython" in your workspace.
load("@cython//Tools:rules.bzl", "pyx_library")
pyx_library(name = 'mylib',
pyx_library(name = 'mylib',
srcs = ['a.pyx', 'a.pxd', 'b.py', 'pkg/c.pyx'],
srcs = ['a.pyx', 'a.pxd', 'b.py', 'pkg/
__init__.py', 'pkg/
c.pyx'],
py_deps = ['//py_library/dep'],
py_deps = ['//py_library/dep'],
data = ['//other/data'],
data = ['//other/data'],
)
)
Make sure to include the __init__.py files in your srcs list so that Cython
The __init__.py file must be in your srcs list so that Cython can resolve
c
an resolve c
imports using the package layout.
cimports using the package layout.
"""
"""
def
pyx_library
(
def
pyx_library
(
...
@@ -34,6 +38,7 @@ def pyx_library(
...
@@ -34,6 +38,7 @@ def pyx_library(
else
:
else
:
pxd_srcs
.
append
(
src
)
pxd_srcs
.
append
(
src
)
if
src
.
endswith
(
'__init__.py'
):
if
src
.
endswith
(
'__init__.py'
):
# TODO(robertwb): Infer __init__.py files/package root?
pxd_srcs
.
append
(
src
)
pxd_srcs
.
append
(
src
)
# Invoke cythonize to produce the shared object libraries.
# Invoke cythonize to produce the shared object libraries.
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment