Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
snakehouse
Manage
Activity
Members
Labels
Plan
Issues
0
Issue boards
Milestones
Wiki
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package Registry
Container Registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
public
snakehouse
Commits
96ea5097
Commit
96ea5097
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
proper handling of Extensions in the list
parent
7d7a33d5
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
example/example.pyx
+2
-0
2 additions, 0 deletions
example/example.pyx
example/setup.py
+10
-6
10 additions, 6 deletions
example/setup.py
example/tests/test_test.py
+4
-0
4 additions, 0 deletions
example/tests/test_test.py
snakehouse/build.py
+12
-4
12 additions, 4 deletions
snakehouse/build.py
with
28 additions
and
10 deletions
example/example.pyx
0 → 100644
+
2
−
0
View file @
96ea5097
def
test
(
x
,
y
):
return
x
+
y
This diff is collapsed.
Click to expand it.
example/setup.py
+
10
−
6
View file @
96ea5097
from
setuptools
import
setup
,
find_packages
from
setuptools
import
setup
,
find_packages
from
snakehouse
import
Multibuild
,
build
from
snakehouse
import
Multibuild
,
build
from
setuptools
import
Extension
# note that you can include standard Extension classes in this list, those won't be touched
# and will be directed directly to Cython.Build.cythonize()
cython_multibuilds
=
[
cython_multibuilds
=
[
Multibuild
(
'
example_module
'
,
[
'
example_module/test.pyx
'
,
'
example_module/test2.pyx
'
,
Multibuild
(
'
example_module
'
,
[
'
example_module/test.pyx
'
,
'
example_module/test2.pyx
'
,
'
example_module/test3/test3.pyx
'
,
'
example_module/test3/test3.pyx
'
,
'
example_module/test_n.c
'
])
'
example_module/test_n.c
'
]),
Extension
(
'
example
'
,
[
'
example.pyx
'
])
]
]
# first argument is used directly by snakehouse, the rest and **kwargs are passed to
# first argument is used directly by snakehouse, the rest and **kwargs are passed to
# Cython.Build.cythonize
# Cython.Build.cythonize
()
ext_modules
=
build
(
cython_multibuilds
,
ext_modules
=
build
(
cython_multibuilds
,
compiler_directives
=
{
compiler_directives
=
{
'
language_level
'
:
'
3
'
,
'
language_level
'
:
'
3
'
,
})
})
setup
(
name
=
'
example_module
'
,
setup
(
name
=
'
example_module
'
,
version
=
'
0.1
'
,
version
=
'
0.1
'
,
packages
=
find_packages
(
include
=
[
'
example_module
'
]
)
,
packages
=
[
'
example_module
'
,
'
example
'
],
install_requires
=
[
install_requires
=
[
'
Cython
'
,
'
snakehouse
'
'
Cython
'
,
'
snakehouse
'
],
],
...
...
This diff is collapsed.
Click to expand it.
example/tests/test_test.py
+
4
−
0
View file @
96ea5097
from
example_module.test
import
times_two
from
example_module.test
import
times_two
from
example_module.test2
import
times_three
,
times_five
from
example_module.test2
import
times_three
,
times_five
from
example_module.test3.test3
import
times_four
from
example_module.test3.test3
import
times_four
from
example
import
test
import
unittest
import
unittest
class
TestExample
(
unittest
.
TestCase
):
class
TestExample
(
unittest
.
TestCase
):
def
test_test
(
self
):
self
.
assertEqual
(
test
(
2
,
3
),
5
)
def
test_five
(
self
):
def
test_five
(
self
):
self
.
assertEqual
(
times_five
(
2
),
10
)
self
.
assertEqual
(
times_five
(
2
),
10
)
...
...
This diff is collapsed.
Click to expand it.
snakehouse/build.py
+
12
−
4
View file @
96ea5097
import
typing
as
tp
from
Cython.Build
import
cythonize
from
Cython.Build
import
cythonize
from
setuptools
import
Extension
from
.multibuild
import
Multibuild
def
build
(
extensions
,
*
args
,
**
kwargs
):
def
build
(
extensions
:
tp
.
List
[
tp
.
Union
[
Multibuild
,
Extension
]],
*
args
,
**
kwargs
):
for
multibuild
in
extensions
:
returns
=
[]
multibuild
.
generate
()
for
multi_build
in
extensions
:
return
cythonize
([
ext
.
for_cythonize
()
for
ext
in
extensions
],
*
args
,
**
kwargs
)
if
isinstance
(
multi_build
,
Extension
):
returns
.
append
(
multi_build
)
else
:
multi_build
.
generate
()
returns
.
append
(
multi_build
.
for_cythonize
())
return
cythonize
(
returns
,
*
args
,
**
kwargs
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment