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
3e1fea20
Commit
3e1fea20
authored
11 years ago
by
Donald Stufft
Browse files
Options
Downloads
Patches
Plain Diff
Enable using the system library and falling back to the bundled
parent
bc3ad28c
No related branches found
Branches containing commit
No related tags found
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
.travis.yml
+22
-5
22 additions, 5 deletions
.travis.yml
setup.py
+51
-6
51 additions, 6 deletions
setup.py
with
73 additions
and
11 deletions
.travis.yml
+
22
−
5
View file @
3e1fea20
language
:
python
python
:
2.7
env
:
-
TOXENV=py26
-
TOXENV=py27
-
TOXENV=py32
-
TOXENV=py33
-
TOXENV=pypy
-
TOXENV=py26 SODIUM_INSTALL=bundled
-
TOXENV=py27 SODIUM_INSTALL=bundled
-
TOXENV=py32 SODIUM_INSTALL=bundled
-
TOXENV=py33 SODIUM_INSTALL=bundled
-
TOXENV=pypy SODIUM_INSTALL=bundled
-
TOXENV=py26 SODIUM_INSTALL=system
-
TOXENV=py27 SODIUM_INSTALL=system
-
TOXENV=py32 SODIUM_INSTALL=system
-
TOXENV=py33 SODIUM_INSTALL=system
-
TOXENV=pypy SODIUM_INSTALL=system
install
:
# Add the PyPy repository
...
...
@@ -16,6 +21,18 @@ install:
# This is required because we need to get rid of the Travis installed PyPy
# or it'll take precedence over the PPA installed one.
-
"
if
[[
$TOXENV
==
'pypy'
]];
then
sudo
rm
-rf
/usr/local/pypy/bin;
fi"
# Install Sodium if we need too
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
wget
https://download.libsodium.org/libsodium/releases/LATEST.tar.gz;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
tar
zxvf
LATEST.tar.gz;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
cd
libsodium-*;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
./configure;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
make;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
make
check;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
sudo
make
install;
fi"
-
"
if
[[
$SODIUM_INSTALL
==
'system'
]];
then
sudo
ldconfig;
fi"
# Install tox and coveralls so we can run our tests
-
pip install tox coveralls
...
...
This diff is collapsed.
Click to expand it.
setup.py
+
51
−
6
View file @
3e1fea20
...
...
@@ -25,6 +25,10 @@ from distutils.command.build_ext import build_ext as _build_ext
from
setuptools
import
Distribution
,
setup
SODIUM_MAJOR
=
4
SODIUM_MINOR
=
3
def
here
(
*
paths
):
return
os
.
path
.
abspath
(
os
.
path
.
join
(
os
.
path
.
dirname
(
__file__
),
*
paths
))
...
...
@@ -67,10 +71,45 @@ else:
ext_modules
=
[
nacl
.
nacl
.
ffi
.
verifier
.
get_extension
()]
def
use_system
():
install_type
=
os
.
environ
.
get
(
"
SODIUM_INSTALL
"
)
if
install_type
==
"
system
"
:
# If we are forcing system installs, don't compile the bundled one
return
True
elif
install_type
==
"
bundled
"
:
# If we are forcing bundled installs, compile it
return
False
# Detect if we have libsodium available
import
cffi
ffi
=
cffi
.
FFI
()
ffi
.
cdef
(
"""
int sodium_library_version_major();
int sodium_library_version_minor();
"""
)
try
:
system
=
ffi
.
dlopen
(
"
libsodium
"
)
except
OSError
:
# We couldn't locate libsodium so we'll use the bundled one
return
False
if
system
.
sodium_library_version_major
()
!=
SODIUM_MAJOR
:
return
False
if
system
.
sodium_library_version_minor
()
<
SODIUM_MINOR
:
return
False
# If we got this far then the system library should be good enough
return
True
class
Distribution
(
Distribution
):
def
has_c_libraries
(
self
):
return
True
return
not
use_system
()
class
build_clib
(
_build_clib
):
...
...
@@ -95,6 +134,9 @@ class build_clib(_build_clib):
return
[
"
sodium
"
]
def
run
(
self
):
if
use_system
():
return
build_temp
=
os
.
path
.
abspath
(
self
.
build_temp
)
# Ensure our temporary build directory exists
...
...
@@ -129,11 +171,14 @@ class build_clib(_build_clib):
class
build_ext
(
_build_ext
):
def
run
(
self
):
build_clib
=
self
.
get_finalized_command
(
"
build_clib
"
)
self
.
include_dirs
.
append
(
os
.
path
.
join
(
build_clib
.
build_clib
,
"
include
"
)
)
self
.
library_dirs
.
append
(
os
.
path
.
join
(
build_clib
.
build_clib
,
"
lib
"
))
if
self
.
distribution
.
has_c_libraries
():
build_clib
=
self
.
get_finalized_command
(
"
build_clib
"
)
self
.
include_dirs
.
append
(
os
.
path
.
join
(
build_clib
.
build_clib
,
"
include
"
),
)
self
.
library_dirs
.
append
(
os
.
path
.
join
(
build_clib
.
build_clib
,
"
lib
"
),
)
return
_build_ext
.
run
(
self
)
...
...
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