Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
H
http-server
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
1
Merge Requests
1
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
cython-plus
http-server
Commits
b1628e1e
Commit
b1628e1e
authored
Nov 10, 2021
by
Xavier Thompson
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Add helloworld.pyx demo
parent
e8e83de2
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
52 additions
and
0 deletions
+52
-0
src/Makefile
src/Makefile
+14
-0
src/helloworld.pyx
src/helloworld.pyx
+17
-0
src/setup.py
src/setup.py
+21
-0
No files found.
src/Makefile
0 → 100644
View file @
b1628e1e
%.so
:
%.pyx
python3 setup.py build_ext
--inplace
$*
&&
mv
$*
.
*
.so
$@
%
:
%.so
@
echo
">>> import
$@
"
&&
python3
-c
"import
$@
"
clean
:
rm
-rf
build
rm
-rf
*
.cpp
*
.c
rm
-rf
*
.so
.PHONY
:
clean
.PRECIOUS
:
%.so
.SUFFIXES
:
src/helloworld.pyx
0 → 100644
View file @
b1628e1e
from
stdlib.string
cimport
Str
from
libc.stdio
cimport
puts
def
main
():
with
nogil
:
hello
=
Str
(
"hello"
)
world
=
Str
(
"world"
)
hello_world
=
hello
+
world
puts
(
Str
.
to_c_str
(
hello_world
))
hello_again
=
hello_world
.
substr
(
0
,
5
)
puts
(
Str
.
to_c_str
(
hello_again
))
world_again
=
hello_world
.
substr
(
5
,
10
)
puts
(
Str
.
to_c_str
(
world_again
))
main
()
src/setup.py
0 → 100644
View file @
b1628e1e
from
distutils.core
import
setup
from
distutils.extension
import
Extension
from
Cython.Build
import
cythonize
import
sys
src
=
sys
.
argv
[
-
1
]
sys
.
argv
[:]
=
sys
.
argv
[:
-
1
]
extensions
=
[
Extension
(
src
,
language
=
'c++'
,
sources
=
[
src
+
'.pyx'
],
extra_compile_args
=
[
'-std=c++17'
],
)
]
setup
(
ext_modules
=
cythonize
(
extensions
)
)
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