Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
setuptools_dso
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
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
setuptools_dso
Commits
0adb63b5
Commit
0adb63b5
authored
Jan 22, 2021
by
Michael Davidsaver
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
doc
parent
b3abb7c0
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
25 additions
and
7 deletions
+25
-7
README.md
README.md
+25
-7
No files found.
README.md
View file @
0adb63b5
...
@@ -9,11 +9,29 @@ built from source within the python ecosystem.
...
@@ -9,11 +9,29 @@ built from source within the python ecosystem.
See
[
example/setup.py
](
example/setup.py
)
for a working example.
See
[
example/setup.py
](
example/setup.py
)
for a working example.

[

](https://github.com/mdavidsaver/setuptools_dso/actions)
## Building packages
Packages using
`setuptools_dso`
can for the most part be treated like any other python package.
Distribution through
[
pypi.org
](
https://pypi.org/
)
as source and/or binary (wheels) is possible.
Like other packages containing compiled code, use of egg binaries is not supported.
Use of PIP is encouraged.
The
`setuptools_dso`
package needs to be installed when manually invoking
`setup.py`
scripts in dependent packages.
eg. to generate source tars with
`setup.py sdist`
.
Developers wishing to work with an in-place build will need to use the added
`build_dso`
command,
which functions like the
`build_ext`
command.
```
sh
python setup.py build_dso
-i
python setup.py build_ext
-i
```
## Usage
## Usage
The
[
example/
](
example/
setup.py
)
demonstrates building a non-python library,
The
[
example/
](
example/
)
demonstrates building a non-python library,
and linking it with a python extension module.
and linking it with a python extension module.
### pyproject.toml
### pyproject.toml
...
@@ -99,7 +117,7 @@ when the `dsodemo.ext.dtest` Extension is imported on Windows.
...
@@ -99,7 +117,7 @@ when the `dsodemo.ext.dtest` Extension is imported on Windows.
The example places this in
[
`example/src/dsodemo/__init__.py`
](
example/src/dsodemo/__init__.py
)
The example places this in
[
`example/src/dsodemo/__init__.py`
](
example/src/dsodemo/__init__.py
)
to ensure it always runs before the extension library is loaded.
to ensure it always runs before the extension library is loaded.
```
```
py
import
sys
,
os
import
sys
,
os
def
fixpath
():
def
fixpath
():
...
@@ -146,7 +164,7 @@ The supporting library is then linked with a library name of `libsup.so.0`
...
@@ -146,7 +164,7 @@ The supporting library is then linked with a library name of `libsup.so.0`
(eg.
`gcc -o libsup.so.0 -shared -Wl,-soname,libsup.so.0 ...`
)
(eg.
`gcc -o libsup.so.0 -shared -Wl,-soname,libsup.so.0 ...`
)
When linking a dependent library or extension module
`-Wl,-rpath,'$ORIGIN/lib'`
When linking a dependent library or extension module
`-Wl,-rpath,'$ORIGIN/lib'`
is given since the relative path from
_ext.so to libsup.so.0 is './lib'
.
is given since the relative path from
`_ext.so`
to
`libsup.so.0`
is
`./lib`
.
Note that on Linux runtime linking is really a function of the libc (eg. glibc).
Note that on Linux runtime linking is really a function of the libc (eg. glibc).
...
@@ -163,8 +181,8 @@ Then `-Wl,-rpath,'$ORIGIN/lib'` becomes `-Wl,-rpath,@loader_path/lib`.
...
@@ -163,8 +181,8 @@ Then `-Wl,-rpath,'$ORIGIN/lib'` becomes `-Wl,-rpath,@loader_path/lib`.
There is no equivalent for RPATH.
There is no equivalent for RPATH.
It is necessary to adjust the loader search path to include the directory
It is necessary to adjust the loader search path to include the directory
containing the support library dll explicitly from python code prior to loading the extension.
containing the support library dll explicitly from python code prior to loading the extension.
(eg. from an
\_\_
init
\_\_
.py
)
(eg. from an
`__init__.py`
)
With
older versions of Windows it is sufficient to adjust %PATH%
.
With
earlier versions of Windows it is sufficient to adjust
`%PATH%`
.
Newer
versions require use of the
`AddDllDirectory()`
API call.
Recent
versions require use of the
`AddDllDirectory()`
API call.
Python wraps this as
`os.add_dll_directory()`
.
Python wraps this as
`os.add_dll_directory()`
.
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