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
f135e4a2
Commit
f135e4a2
authored
12 years ago
by
Donald Stufft
Browse files
Options
Downloads
Patches
Plain Diff
Move install.sodium into nacl proper and switch to using it
parent
66aa1183
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
.travis.yml
+3
-4
3 additions, 4 deletions
.travis.yml
nacl/invoke/__init__.py
+0
-0
0 additions, 0 deletions
nacl/invoke/__init__.py
nacl/invoke/sodium.py
+49
-0
49 additions, 0 deletions
nacl/invoke/sodium.py
setup.py
+1
-0
1 addition, 0 deletions
setup.py
tasks.py
+5
-61
5 additions, 61 deletions
tasks.py
with
58 additions
and
65 deletions
.travis.yml
+
3
−
4
View file @
f135e4a2
...
@@ -6,10 +6,9 @@ python:
...
@@ -6,10 +6,9 @@ python:
-
"
3.3"
-
"
3.3"
# - "pypy" # Travis only has PyPy 1.9, cffi requires 2.0 (Unreleased)
# - "pypy" # Travis only has PyPy 1.9, cffi requires 2.0 (Unreleased)
install
:
install
:
-
sudo apt-get -q install python-pip
-
pip install invoke
-
sudo /usr/bin/pip -q install git+git://github.com/pyinvoke/invoke.git
-
pip install file://$PWD#egg=pynacl[tests]
-
invoke install.sodium
-
invoke sodium.install
-
invoke install.requirements --dev
script
:
script
:
-
invoke tests
-
invoke tests
env
:
env
:
...
...
This diff is collapsed.
Click to expand it.
nacl/invoke/__init__.py
0 → 100644
+
0
−
0
View file @
f135e4a2
This diff is collapsed.
Click to expand it.
nacl/invoke/sodium.py
0 → 100644
+
49
−
0
View file @
f135e4a2
import
hashlib
import
os
try
:
from
urllib.request
import
urlopen
except
ImportError
:
from
urllib2
import
urlopen
from
invoke
import
task
,
run
LIBSODIUM_VERSION
=
"
0.3
"
LIBSODIUM_URL
=
"
http://download.dnscrypt.org/libsodium/releases/libsodium-0.3.tar.gz
"
LIBSODIUM_HASH
=
b
"
908a26f84bedb432305c81ec6773aa95b8e724ba2ece6234840685a74e033750
"
@task
def
install
():
path
=
os
.
path
.
expanduser
(
"
~/libsodium-%s.tar.gz
"
%
LIBSODIUM_VERSION
)
# Download libsodium and verify it's hash
resp
=
urlopen
(
LIBSODIUM_URL
)
content
=
resp
.
read
()
content_hash
=
hashlib
.
sha256
(
content
).
hexdigest
()
# Verify our content matches the expected hash
if
content_hash
!=
LIBSODIUM_HASH
:
raise
ValueError
(
"
Hash mismatch for downloaded sodium
"
)
# Write out the tarball
with
open
(
path
,
"
wb
"
)
as
fp
:
fp
.
write
(
content
)
curdir
=
os
.
getcwd
()
try
:
os
.
chdir
(
os
.
path
.
expanduser
(
"
~/
"
))
# Unpack the tarball
run
(
"
tar xf libsodium-%s.tar.gz
"
%
LIBSODIUM_VERSION
)
# Configure and install the library
os
.
chdir
(
os
.
path
.
expanduser
(
"
~/libsodium-%s/
"
%
LIBSODIUM_VERSION
))
run
(
"
./configure --disable-debug --disable-dependency-tracking
"
,
hide
=
"
out
"
,
)
run
(
"
make
"
,
hide
=
"
out
"
)
run
(
"
sudo make install
"
,
hide
=
"
out
"
)
finally
:
os
.
chdir
(
curdir
)
This diff is collapsed.
Click to expand it.
setup.py
+
1
−
0
View file @
f135e4a2
...
@@ -50,6 +50,7 @@ setup(
...
@@ -50,6 +50,7 @@ setup(
packages
=
[
packages
=
[
"
nacl
"
,
"
nacl
"
,
"
nacl.invoke
"
,
],
],
ext_package
=
"
nacl
"
,
ext_package
=
"
nacl
"
,
...
...
This diff is collapsed.
Click to expand it.
tasks.py
+
5
−
61
View file @
f135e4a2
import
hashlib
from
invoke
import
Collection
,
task
,
run
import
os
import
urllib2
from
invoke
import
task
,
run
from
nacl.
invoke
import
sodium
ns
=
Collection
()
LIBSODIUM_VERSION
=
"
0.3
"
ns
.
add_collection
(
sodium
)
LIBSODIUM_URL
=
"
http://download.dnscrypt.org/libsodium/releases/libsodium-0.3.tar.gz
"
LIBSODIUM_HASH
=
b
"
908a26f84bedb432305c81ec6773aa95b8e724ba2ece6234840685a74e033750
"
LIBSODIUM_AUTOGEN
=
False
@task
(
aliases
=
[
"
install.sodium
"
])
def
install_sodium
():
tarball_path
=
os
.
path
.
expanduser
(
"
~/libsodium-{}.tar.gz
"
.
format
(
LIBSODIUM_VERSION
),
)
# Download libsodium and verify it's hash
resp
=
urllib2
.
urlopen
(
LIBSODIUM_URL
)
content
=
resp
.
read
()
content_hash
=
hashlib
.
sha256
(
content
).
hexdigest
()
if
content_hash
!=
LIBSODIUM_HASH
:
raise
ValueError
(
"
Hash mismatch for downloaded libsodium
"
)
with
open
(
tarball_path
,
"
wb
"
)
as
fp
:
fp
.
write
(
content
)
curdir
=
os
.
getcwd
()
try
:
os
.
chdir
(
os
.
path
.
expanduser
(
"
~/
"
))
# Unpack the tarball
run
(
"
tar xf libsodium-{}.tar.gz
"
.
format
(
LIBSODIUM_VERSION
))
# Configure and install the library
os
.
chdir
(
os
.
path
.
expanduser
(
"
~/libsodium-{}/
"
.
format
(
LIBSODIUM_VERSION
),
))
if
LIBSODIUM_AUTOGEN
:
run
(
"
./autogen.sh
"
,
hide
=
"
out
"
)
run
(
"
./configure --disable-debug --disable-dependency-tracking
"
,
hide
=
"
out
"
,
)
run
(
"
make
"
,
hide
=
"
out
"
)
run
(
"
sudo make install
"
,
hide
=
"
out
"
)
finally
:
os
.
chdir
(
curdir
)
@task
(
aliases
=
[
"
install.requirements
"
])
def
install_requirements
(
dev
=
False
):
if
dev
:
# Install once to get the tests extra
run
(
"
pip install file://$PWD#egg=pynacl[tests]
"
)
# Install again to get an editable install
run
(
"
pip install -e .
"
)
else
:
run
(
"
pip install .
"
)
@ns.add_task
@task
@task
def
tests
():
def
tests
():
run
(
"
py.test
"
)
run
(
"
py.test
"
)
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