Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
sakia
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Model registry
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
clients
python
sakia
Commits
adf1add1
Commit
adf1add1
authored
11 years ago
by
Donald Stufft
Browse files
Options
Downloads
Patches
Plain Diff
Use ./configure and parsing the Makefile to enable optional defines
parent
7fa88748
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
setup.py
+59
-2
59 additions, 2 deletions
setup.py
with
59 additions
and
2 deletions
setup.py
+
59
−
2
View file @
adf1add1
#!/usr/bin/env python
#!/usr/bin/env python
import
sys
import
sys
import
os.path
import
os.path
import
shlex
import
subprocess
from
distutils.command.build_clib
import
build_clib
as
_build_clib
from
setuptools
import
setup
from
setuptools
import
setup
from
setuptools.command.test
import
test
as
TestCommand
from
setuptools.command.test
import
test
as
TestCommand
...
@@ -23,6 +27,41 @@ else:
...
@@ -23,6 +27,41 @@ else:
ext_modules
[
0
].
include_dirs
.
append
(
here
(
"
libsodium/src/libsodium/include
"
))
ext_modules
[
0
].
include_dirs
.
append
(
here
(
"
libsodium/src/libsodium/include
"
))
class
build_clib
(
_build_clib
):
def
run
(
self
):
# Run ./configure
subprocess
.
check_call
(
"
./configure --disable-debug --disable-dependency-tracking
"
,
cwd
=
here
(
"
libsodium
"
),
shell
=
True
,
)
# Parse the Makefile to determine what macros to define
with
open
(
here
(
"
libsodium/Makefile
"
))
as
makefile
:
for
line
in
makefile
:
if
line
.
startswith
(
"
DEFS
"
):
defines
=
[
tuple
(
shlex
.
split
(
i
)[
0
][
2
:].
split
(
"
=
"
,
1
))
for
i
in
shlex
.
split
(
line
)
if
i
.
startswith
(
"
-D
"
)
]
# Configure libsodium using the Makefile defines
libraries
=
[]
for
libname
,
build_info
in
self
.
libraries
:
if
libname
==
"
sodium
"
:
# Store the define macros inside the build info
macros
=
dict
(
build_info
.
get
(
"
macros
"
,
[]))
macros
.
update
(
dict
(
defines
))
build_info
[
"
macros
"
]
=
list
(
macros
.
items
())
libraries
.
append
((
libname
,
build_info
))
self
.
libraries
=
libraries
# Call our normal run
return
_build_clib
.
run
(
self
)
class
PyTest
(
TestCommand
):
class
PyTest
(
TestCommand
):
def
finalize_options
(
self
):
def
finalize_options
(
self
):
TestCommand
.
finalize_options
(
self
)
TestCommand
.
finalize_options
(
self
)
...
@@ -198,20 +237,38 @@ setup(
...
@@ -198,20 +237,38 @@ setup(
"
sodium/version.c
"
,
"
sodium/version.c
"
,
# THIS STUFF IS UNDEFINED?
# THIS STUFF IS UNDEFINED?
"
crypto_scalarmult/curve25519/scalarmult_curve25519_api.c
"
,
"
crypto_scalarmult/curve25519/ref/base_curve25519_ref.c
"
,
"
crypto_scalarmult/curve25519/ref/base_curve25519_ref.c
"
,
"
crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c
"
,
"
crypto_scalarmult/curve25519/ref/smult_curve25519_ref.c
"
,
# "crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c",
# "crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c",
# "crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c",
# "crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c",
"
crypto_stream/salsa20/ref/stream_salsa20_ref.c
"
,
"
crypto_stream/salsa20/ref/stream_salsa20_ref.c
"
,
"
crypto_stream/salsa20/ref/xor_salsa20_ref.c
"
,
"
crypto_stream/salsa20/ref/xor_salsa20_ref.c
"
,
#
# 'crypto_auth/try.c',
#'crypto_box/try.c',
'
crypto_generichash/blake2/ref/blake2s-ref.c
'
,
#'crypto_hash/try.c',
#'crypto_hashblocks/try.c',
'
crypto_scalarmult/curve25519/donna_c64/base_curve25519_donna_c64.c
'
,
'
crypto_scalarmult/curve25519/donna_c64/smult_curve25519_donna_c64.c
'
,
#'crypto_scalarmult/try.c',
#'crypto_secretbox/try.c',
#'crypto_sign/try.c',
'
crypto_stream/salsa20/stream_salsa20_api.c
'
,
#'crypto_stream/try.c',
#'crypto_verify/try.c'
]
]
],
],
}),
}),
],
],
zip_safe
=
False
,
zip_safe
=
False
,
cmdclass
=
{
"
test
"
:
PyTest
},
cmdclass
=
{
"
build_clib
"
:
build_clib
,
"
test
"
:
PyTest
,
},
classifiers
=
[
classifiers
=
[
"
Programming Language :: Python :: Implementation :: CPython
"
,
"
Programming Language :: Python :: Implementation :: CPython
"
,
...
...
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