Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
C
carputils
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
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
openCARP
carputils
Commits
f9995357
Commit
f9995357
authored
5 years ago
by
Jochen Klar
Browse files
Options
Downloads
Patches
Plain Diff
Use setuptools.dist.Distribution instead of BuildExtCommand
parent
59fd74f8
Branches
improve_setup
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+9
-16
9 additions, 16 deletions
setup.py
with
9 additions
and
16 deletions
setup.py
+
9
−
16
View file @
f9995357
...
...
@@ -22,9 +22,10 @@ email: gsell.matthias@gmail.com
date: 03-01-2020
"""
from
distutils.command.build_ext
import
build_ext
from
distutils.core
import
setup
from
distutils.extension
import
Extension
from
setuptools
import
Extension
,
dist
,
setup
# install numpy before main is called
dist
.
Distribution
().
fetch_build_eggs
([
'
numpy~=1.18
'
])
MAJOR_VERSION
=
1
MINOR_VERSION
=
1
...
...
@@ -34,6 +35,8 @@ VERSION = '{}.{}.{}'.format(MAJOR_VERSION, MINOR_VERSION, PATCH_LEVEL)
def
main
():
import
numpy
macros
=
[(
'
MAJOR_VERSION
'
,
str
(
MAJOR_VERSION
)),
(
'
MINOR_VERSION
'
,
str
(
MINOR_VERSION
)),
(
'
PATCH_LEVEL
'
,
str
(
PATCH_LEVEL
)),
...
...
@@ -46,18 +49,21 @@ def main():
mshread_ext
=
Extension
(
'
mshread
'
,
sources
=
[
'
src/mshread.c
'
],
define_macros
=
macros
,
include_dirs
=
[
numpy
.
get_include
()],
extra_compile_args
=
compile_args
,
extra_link_args
=
link_args
)
mshwrite_ext
=
Extension
(
'
mshwrite
'
,
sources
=
[
'
src/mshwrite.c
'
],
define_macros
=
macros
,
include_dirs
=
[
numpy
.
get_include
()],
extra_compile_args
=
compile_args
,
extra_link_args
=
link_args
)
mshutils_ext
=
Extension
(
'
mshutils
'
,
sources
=
[
'
src/mshutils.c
'
],
define_macros
=
macros
,
include_dirs
=
[
numpy
.
get_include
()],
extra_compile_args
=
compile_args
,
extra_link_args
=
link_args
)
...
...
@@ -68,23 +74,10 @@ def main():
author_email
=
"
gsell.matthias@gmail.com
"
,
ext_package
=
'
carputils.mshext
'
,
ext_modules
=
[
mshread_ext
,
mshwrite_ext
,
mshutils_ext
],
cmdclass
=
{
'
build_ext
'
:
BuildExtCommand
},
install_requires
=
[
'
numpy
'
])
class
BuildExtCommand
(
build_ext
):
'''
Custom BuildExtCommand to include numpy only at build time
see also: https://stackoverflow.com/a/54717012
'''
def
run
(
self
):
import
numpy
self
.
include_dirs
.
append
(
numpy
.
get_include
())
build_ext
.
run
(
self
)
if
__name__
==
'
__main__
'
:
main
()
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