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
0f7d27bd
Commit
0f7d27bd
authored
5 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
move constants to separate files
parent
8f7d842e
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
+6
-1
6 additions, 1 deletion
snakehouse/constants.py
snakehouse/multibuild.py
+5
-5
5 additions, 5 deletions
snakehouse/multibuild.py
with
11 additions
and
6 deletions
snakehouse/constants.py
+
6
−
1
View file @
0f7d27bd
...
...
@@ -78,4 +78,9 @@ BOOTSTRAP_PYX_GET_DEFINITION_IF = """ if name == %s:
BOOTSTRAP_PYX_GET_DEFINITION_ELIF
=
"""
elif name == %s:
return %s
"""
\ No newline at end of file
"""
INCLUDE_PYTHON_H
=
'
#include
"
Python.h
"
\n
'
INCLUDE_PYINIT
=
'
PyObject* PyInit_%s();
'
This diff is collapsed.
Click to expand it.
snakehouse/multibuild.py
+
5
−
5
View file @
0f7d27bd
...
...
@@ -3,7 +3,7 @@ import os
from
setuptools
import
Extension
from
.constants
import
BOOTSTRAP_PYX_HEADER
,
BOOTSTRAP_PYX_PACKAGE_LOADER
,
INIT_PY_CONTENTS
,
\
BOOTSTRAP_PYX_CDEF
,
BOOTSTRAP_PYX_GET_DEFINITION_HEADER
,
BOOTSTRAP_PYX_GET_DEFINITION_IF
,
\
BOOTSTRAP_PYX_GET_DEFINITION_ELIF
BOOTSTRAP_PYX_GET_DEFINITION_ELIF
,
INCLUDE_PYTHON_H
,
INCLUDE_PYINIT
class
Multibuild
:
...
...
@@ -33,14 +33,14 @@ class Multibuild:
module_name
=
name
.
replace
(
'
.pyx
'
,
''
)
h_name
=
name
.
replace
(
'
.pyx
'
,
'
.h
'
)
exported_line
=
'
PyObject* PyInit_%s();
'
%
(
module_name
,)
exported_line
=
INCLUDE_PYINIT
%
(
module_name
,)
if
os
.
path
.
exists
(
h_name
):
with
open
(
os
.
path
.
join
(
path
,
h_name
),
'
r
'
)
as
f_in
:
data
=
f_in
.
read
()
if
'
#include
"
Python.h
"'
not
in
data
:
data
=
'
#include
"
Python.h
"
\n
'
+
data
if
INCLUDE_PYTHON_H
not
in
data
:
data
=
INCLUDE_PYTHON_H
+
data
if
exported_line
not
in
data
:
data
=
data
+
'
\n
'
+
exported_line
+
'
\n
'
...
...
@@ -49,7 +49,7 @@ class Multibuild:
f_out
.
write
(
data
)
else
:
with
open
(
os
.
path
.
join
(
path
,
h_name
),
'
w
'
)
as
f_out
:
f_out
.
write
(
'
#include
"
Python.h
"
\n
'
)
f_out
.
write
(
INCLUDE_PYTHON_H
)
f_out
.
write
(
'
\n
'
+
exported_line
+
'
\n
'
)
def
generate_bootstrap
(
self
)
->
str
:
...
...
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