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
6a292543
Commit
6a292543
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
fixed the module somehow
parent
9cbcf9d2
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
snakehouse/constants.py
+1
-1
1 addition, 1 deletion
snakehouse/constants.py
snakehouse/multibuild.py
+10
-10
10 additions, 10 deletions
snakehouse/multibuild.py
with
11 additions
and
11 deletions
snakehouse/constants.py
+
1
−
1
View file @
6a292543
...
@@ -72,7 +72,7 @@ BOOTSTRAP_PYX_GET_DEFINITION_HEADER = """
...
@@ -72,7 +72,7 @@ BOOTSTRAP_PYX_GET_DEFINITION_HEADER = """
cdef object get_definition_by_name(str name):
cdef object get_definition_by_name(str name):
"""
"""
BOOTSTRAP_PYX_GET_DEFINITION_IF
=
"""
if name == %s:
BOOTSTRAP_PYX_GET_DEFINITION_IF
=
"""
if name == %s:
return %s
return %s
"""
"""
...
...
This diff is collapsed.
Click to expand it.
snakehouse/multibuild.py
+
10
−
10
View file @
6a292543
...
@@ -7,6 +7,9 @@ from .constants import BOOTSTRAP_PYX_HEADER, BOOTSTRAP_PYX_PACKAGE_LOADER, INIT_
...
@@ -7,6 +7,9 @@ from .constants import BOOTSTRAP_PYX_HEADER, BOOTSTRAP_PYX_PACKAGE_LOADER, INIT_
class
Multibuild
:
class
Multibuild
:
"""
This specifies a single Cython extension, called {extension_name}.__bootstrap__
"""
def
__init__
(
self
,
extension_name
:
str
,
files
):
def
__init__
(
self
,
extension_name
:
str
,
files
):
"""
"""
:param extension_name: the module name
:param extension_name: the module name
...
@@ -18,20 +21,19 @@ class Multibuild:
...
@@ -18,20 +21,19 @@ class Multibuild:
raise
ValueError
(
'
Two modules with the same name cannot appear together in a single
'
raise
ValueError
(
'
Two modules with the same name cannot appear together in a single
'
'
Multibuild
'
)
'
Multibuild
'
)
self
.
sane
_files
=
[
file
for
file
in
files
if
file
.
endswith
(
'
.pyx
'
)]
self
.
pyx
_files
=
[
file
for
file
in
files
if
file
.
endswith
(
'
.pyx
'
)]
self
.
extension_name
=
extension_name
self
.
extension_name
=
extension_name
self
.
bootstrap_directory
=
os
.
path
.
commonpath
(
self
.
files
)
self
.
bootstrap_directory
=
os
.
path
.
commonpath
(
self
.
files
)
self
.
modules
=
set
()
# tp.Set[tp.Tuple[str, str]]
self
.
modules
=
set
()
# tp.Set[tp.Tuple[str, str]]
def
generate_header_files
(
self
):
def
generate_header_files
(
self
):
for
filename
in
self
.
sane
_files
:
for
filename
in
self
.
pyx
_files
:
path
,
name
=
os
.
path
.
split
(
filename
)
path
,
name
=
os
.
path
.
split
(
filename
)
if
not
name
.
endswith
(
'
.pyx
'
):
if
not
name
.
endswith
(
'
.pyx
'
):
continue
continue
module_name
=
name
.
replace
(
'
.pyx
'
,
''
)
module_name
=
name
.
replace
(
'
.pyx
'
,
''
)
h_name
=
name
.
replace
(
'
.pyx
'
,
'
.h
'
)
h_name
=
name
.
replace
(
'
.pyx
'
,
'
.h
'
)
exported_line
=
INCLUDE_PYINIT
%
(
module_name
,)
exported_line
=
INCLUDE_PYINIT
%
(
module_name
,)
...
@@ -44,17 +46,15 @@ class Multibuild:
...
@@ -44,17 +46,15 @@ class Multibuild:
if
exported_line
not
in
data
:
if
exported_line
not
in
data
:
data
=
data
+
'
\n
'
+
exported_line
+
'
\n
'
data
=
data
+
'
\n
'
+
exported_line
+
'
\n
'
with
open
(
os
.
path
.
join
(
path
,
h_name
),
'
w
'
)
as
f_out
:
f_out
.
write
(
data
)
else
:
else
:
with
open
(
os
.
path
.
join
(
path
,
h_name
),
'
w
'
)
as
f_out
:
data
=
INCLUDE_PYTHON_H
+
'
\n
'
+
exported_line
+
'
\n
'
f_out
.
write
(
INCLUDE_PYTHON_H
)
f_out
.
write
(
'
\n
'
+
exported_line
+
'
\n
'
)
with
open
(
os
.
path
.
join
(
path
,
h_name
),
'
w
'
)
as
f_out
:
f_out
.
write
(
data
)
def
generate_bootstrap
(
self
)
->
str
:
def
generate_bootstrap
(
self
)
->
str
:
bootstrap_contents
=
[
BOOTSTRAP_PYX_HEADER
]
bootstrap_contents
=
[
BOOTSTRAP_PYX_HEADER
]
for
filename
in
self
.
sane
_files
:
for
filename
in
self
.
pyx
_files
:
path
,
name
=
os
.
path
.
split
(
filename
)
path
,
name
=
os
.
path
.
split
(
filename
)
if
path
.
startswith
(
self
.
bootstrap_directory
):
if
path
.
startswith
(
self
.
bootstrap_directory
):
path
=
path
[
len
(
self
.
bootstrap_directory
):]
path
=
path
[
len
(
self
.
bootstrap_directory
):]
...
...
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