Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
satella
Manage
Activity
Members
Labels
Plan
Issues
1
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
satella
Commits
2e8ca3d9
Commit
2e8ca3d9
authored
4 years ago
by
Piotr Maślanka
Browse files
Options
Downloads
Patches
Plain Diff
move monkey patch building extensions to snakehouse
parent
813d2318
No related branches found
No related tags found
No related merge requests found
Changes
5
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
CHANGELOG.md
+2
-0
2 additions, 0 deletions
CHANGELOG.md
docs/distutils.rst
+0
-13
0 additions, 13 deletions
docs/distutils.rst
docs/index.rst
+0
-1
0 additions, 1 deletion
docs/index.rst
satella/__init__.py
+1
-1
1 addition, 1 deletion
satella/__init__.py
satella/distutils.py
+0
-51
0 additions, 51 deletions
satella/distutils.py
with
3 additions
and
66 deletions
CHANGELOG.md
+
2
−
0
View file @
2e8ca3d9
# v2.14.25
# v2.14.25
*
moved
`distutils`
to
[
snakehouse
](
https://pypi.org/project/snakehouse/
)
This diff is collapsed.
Click to expand it.
docs/distutils.rst
deleted
100644 → 0
+
0
−
13
View file @
813d2318
Distutils extensions
====================
Below was shamelessly ripped from StackOverflow_, with some changes by me.
.. _StackOverflow: https://stackoverflow.com/questions/11013851/speeding-up-build-process-with-distutils
.. autofunction:: satella.distutils.monkey_patch_parallel_compilation
.. warning:: This function remains experimental and is quite likely to be
dropped from satella and moved into snakehouse_.
.. _snakehouse: https://pypi.org/project/snakehouse/
This diff is collapsed.
Click to expand it.
docs/index.rst
+
0
−
1
View file @
2e8ca3d9
...
@@ -38,7 +38,6 @@ Visit the project's page at GitHub_!
...
@@ -38,7 +38,6 @@ Visit the project's page at GitHub_!
processes
processes
cassandra
cassandra
opentracing
opentracing
distutils
Indices and tables
Indices and tables
...
...
This diff is collapsed.
Click to expand it.
satella/__init__.py
+
1
−
1
View file @
2e8ca3d9
__version__
=
'
2.14.25a
1
'
__version__
=
'
2.14.25a
2
'
This diff is collapsed.
Click to expand it.
satella/distutils.py
deleted
100644 → 0
+
0
−
51
View file @
813d2318
import
typing
as
tp
import
multiprocessing
import
warnings
__all__
=
[
'
monkey_patch_parallel_compilation
'
]
# shamelessly ripped from
# https://stackoverflow.com/questions/11013851/speeding-up-build-process-with-distutils
# with some changes introduced by me
def
monkey_patch_parallel_compilation
(
cores
:
tp
.
Optional
[
int
]
=
None
)
->
None
:
"""
This monkey-patches distutils to provide parallel compilation, even if you have
a single extension built from multiple .c files.
Invoke in your setup.py file
:param cores: amount of cores. Leave at default (None) for autodetection.
"""
if
cores
is
None
:
cores
=
multiprocessing
.
cpu_count
()
# monkey-patch for parallel compilation
def
parallelCCompile
(
self
,
sources
,
output_dir
=
None
,
macros
=
None
,
include_dirs
=
None
,
debug
=
0
,
extra_preargs
=
None
,
extra_postargs
=
None
,
depends
=
None
):
# those lines are copied from distutils.ccompiler.CCompiler directly
macros
,
objects
,
extra_postargs
,
pp_opts
,
build
=
self
.
_setup_compile
(
output_dir
,
macros
,
include_dirs
,
sources
,
depends
,
extra_postargs
)
cc_args
=
self
.
_get_cc_args
(
pp_opts
,
debug
,
extra_preargs
)
# parallel code
import
multiprocessing.pool
def
single_compile
(
obj
):
try
:
src
,
ext
=
build
[
obj
]
except
KeyError
:
return
self
.
_compile
(
obj
,
src
,
ext
,
cc_args
,
extra_postargs
,
pp_opts
)
# evaluate everything
for
_
in
multiprocessing
.
pool
.
ThreadPool
(
cores
).
imap
(
single_compile
,
objects
):
pass
return
objects
import
distutils.ccompiler
distutils
.
ccompiler
.
CCompiler
.
compile
=
parallelCCompile
warnings
.
warn
(
'
This function remains experimental and is likely to be moved into snakehouse
'
,
UserWarning
)
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