Skip to content

Commit

Permalink
Don't require cffi for install
Browse files Browse the repository at this point in the history
  • Loading branch information
DasIch committed Apr 4, 2013
1 parent f58ad08 commit c267e6d
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
2 changes: 1 addition & 1 deletion pwhash/__init__.py
Original file line number Original file line Diff line number Diff line change
Expand Up @@ -9,5 +9,5 @@
from pwhash.hashers import PasswordHasher from pwhash.hashers import PasswordHasher




__version__ = u"0.0.1-dev" __version__ = "0.0.1-dev"
__version_info__ = (0, 0, 1) __version_info__ = (0, 0, 1)
8 changes: 5 additions & 3 deletions requirements.txt
Original file line number Original file line Diff line number Diff line change
@@ -1,5 +1,7 @@
cffi # testing
pexpect-u pexpect-u
sphinx
pytest
tox tox
pytest

# documentation
sphinx
43 changes: 32 additions & 11 deletions setup.py
Original file line number Original file line Diff line number Diff line change
@@ -1,21 +1,30 @@
# coding: utf-8 # coding: utf-8
import os
import sys import sys
from setuptools import setup from setuptools import setup


import pwhash # If cffi is available we can import all our ffi stuff and compile it as
import pwhash.utils # extensions, if it isn't for example when installing from PyPI we skip this.
import pwhash._openssl try:

import pwhash.utils
ext_modules = [ import pwhash._openssl
pwhash.utils.ffi.verifier.get_extension(), except ImportError:
pwhash._openssl.ffi.verifier.get_extension() ext_modules = []
] else:
ext_modules = [
pwhash.utils.ffi.verifier.get_extension(),
pwhash._openssl.ffi.verifier.get_extension()
]


if sys.platform == "darwin": if sys.platform == "darwin":
import pwhash._commoncrypto try:
ext_modules.append(pwhash._commoncrypto.ffi.verifier.get_extension()) import pwhash._commoncrypto
ext_modules.append(pwhash._commoncrypto.ffi.verifier.get_extension())
except ImportError:
pass




# py-bcrypt doesn't support Python 3.x
if sys.version_info >= (3, 0): if sys.version_info >= (3, 0):
extras_require = {} extras_require = {}
else: else:
Expand All @@ -24,9 +33,21 @@
} }




def get_version():
# We can't import pwhash because the cffi dependency and in the future
# others are not installed, yet, so we have to parse pwhash/__init__.py
with open(os.path.join(os.path.dirname(__file__), "pwhash", "__init__.py")) as f:
for line in f:
if line.startswith("__version__"):
return line.split("=")[1].replace('"', '').strip()
break
else:
raise ValueError("__version__ not found")


setup( setup(
name="pwhash", name="pwhash",
version=pwhash.__version__, version=get_version(),
license="BSD", license="BSD",
author="Daniel Neuhäuser", author="Daniel Neuhäuser",
author_email="dasdasich@gmail.com", author_email="dasdasich@gmail.com",
Expand Down

0 comments on commit c267e6d

Please sign in to comment.