Skip to content

Commit

Permalink
Merge master in to get the unconditionalization of dependencies.
Browse files Browse the repository at this point in the history
  • Loading branch information
erikrose committed Jan 15, 2016
2 parents 2771249 + b030341 commit ecbe2a5
Show file tree
Hide file tree
Showing 6 changed files with 60 additions and 14 deletions.
8 changes: 2 additions & 6 deletions acme/setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
# load_pem_private/public_key (>=0.6)
# rsa_recover_prime_factors (>=0.8)
'cryptography>=0.8',
'ndg-httpsclient', # urllib3 InsecurePlatformWarning (#304)
'pyasn1', # urllib3 InsecurePlatformWarning (#304)
# Connection.set_tlsext_host_name (>=0.13)
'PyOpenSSL>=0.13',
'pyrfc3339',
Expand All @@ -29,12 +31,6 @@
'argparse',
])

# Keep in sync with conditional_requirements.py.
if sys.version_info < (2, 7, 9):
# For secure SSL connection with Python 2.7 (InsecurePlatformWarning)
install_requires.append('ndg-httpsclient')
install_requires.append('pyasn1')

docs_extras = [
'Sphinx>=1.0', # autodoc_member_order = 'bysource', autodoc_default_flags
'sphinx_rtd_theme',
Expand Down
23 changes: 22 additions & 1 deletion letsencrypt-apache/letsencrypt_apache/configurator.py
Original file line number Diff line number Diff line change
Expand Up @@ -154,10 +154,16 @@ def prepare(self):
# Set Version
if self.version is None:
self.version = self.get_version()
if self.version < (2, 2):
if self.version < (2, 4):
raise errors.NotSupportedError(
"Apache Version %s not supported.", str(self.version))

if not self._check_aug_version():
raise errors.NotSupportedError(
"Apache plugin support requires libaugeas0 and augeas-lenses "
"version 1.2.0 or higher, please make sure you have you have "
"those installed.")

self.parser = parser.ApacheParser(
self.aug, self.conf("server-root"), self.conf("vhost-root"),
self.version)
Expand All @@ -169,6 +175,21 @@ def prepare(self):

install_ssl_options_conf(self.mod_ssl_conf)

def _check_aug_version(self):
""" Checks that we have recent enough version of libaugeas.
If augeas version is recent enough, it will support case insensitive
regexp matching"""

self.aug.set("/test/path/testing/arg", "aRgUMeNT")
try:
matches = self.aug.match(
"/test//*[self::arg=~regexp('argument', 'i')]")
except RuntimeError:
self.aug.remove("/test/path")
return False
self.aug.remove("/test/path")
return matches

def deploy_cert(self, domain, cert_path, key_path,
chain_path=None, fullchain_path=None): # pylint: disable=unused-argument
"""Deploys certificate to specified virtual host.
Expand Down
16 changes: 16 additions & 0 deletions letsencrypt-apache/letsencrypt_apache/tests/configurator_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,15 @@ def test_prepare_version(self, mock_exe_exists, _):
self.assertRaises(
errors.NotSupportedError, self.config.prepare)

@mock.patch("letsencrypt_apache.parser.ApacheParser")
@mock.patch("letsencrypt_apache.configurator.le_util.exe_exists")
def test_prepare_old_aug(self, mock_exe_exists, _):
mock_exe_exists.return_value = True
self.config.config_test = mock.Mock()
self.config._check_aug_version = mock.Mock(return_value=False) # pylint: disable=protected-access
self.assertRaises(
errors.NotSupportedError, self.config.prepare)

def test_add_parser_arguments(self): # pylint: disable=no-self-use
from letsencrypt_apache.configurator import ApacheConfigurator
# Weak test..
Expand Down Expand Up @@ -978,6 +987,13 @@ def test_make_addrs_sni_ready(self):
self.assertTrue(self.config.parser.find_dir(
"NameVirtualHost", "*:443", exclude=False))

def test_aug_version(self):
mock_match = mock.Mock(return_value=["something"])
self.config.aug.match = mock_match
self.assertEquals(self.config._check_aug_version(), ["something"]) # pylint: disable=protected-access
self.config.aug.match.side_effect = RuntimeError
self.assertFalse(self.config._check_aug_version()) # pylint: disable=protected-access


if __name__ == "__main__":
unittest.main() # pragma: no cover
14 changes: 14 additions & 0 deletions letsencrypt-apache/letsencrypt_apache/tests/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,20 @@ def setUp(self, test_dir="debian_apache_2_4/two_vhost_80",
self.rsa512jwk = jose.JWKRSA.load(test_util.load_vector(
"rsa512_key.pem"))

# Make sure all vhosts in sites-enabled are symlinks (Python packaging
# does not preserve symlinks)
sites_enabled = os.path.join(self.config_path, "sites-enabled")
if not os.path.exists(sites_enabled):
return

for vhost_basename in os.listdir(sites_enabled):
vhost = os.path.join(sites_enabled, vhost_basename)
if not os.path.islink(vhost): # pragma: no cover
os.remove(vhost)
target = os.path.join(
os.path.pardir, "sites-available", vhost_basename)
os.symlink(target, vhost)


class ParserTest(ApacheTest): # pytlint: disable=too-few-public-methods

Expand Down
6 changes: 1 addition & 5 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ def read_file(filename, encoding='utf8'):
# Please update tox.ini when modifying dependency version requirements
install_requires = [
'acme=={0}'.format(version),
'ConfigArgParse>=0.10.0', # python2.6 support, upstream #17
'configobj',
'cryptography>=0.7', # load_pem_x509_certificate
'parsedatetime',
Expand All @@ -53,11 +54,6 @@ def read_file(filename, encoding='utf8'):
install_requires.extend([
# only some distros recognize stdlib argparse as already satisfying
'argparse',
'ConfigArgParse>=0.10.0', # python2.6 support, upstream #17
])
else:
install_requires.extend([
'ConfigArgParse',
])

dev_extras = [
Expand Down
7 changes: 5 additions & 2 deletions tools/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,17 @@ fi

SetVersion() {
ver="$1"
for pkg_dir in $SUBPKGS
for pkg_dir in $SUBPKGS letsencrypt-compatibility-test
do
sed -i "s/^version.*/version = '$ver'/" $pkg_dir/setup.py
done
sed -i "s/^__version.*/__version__ = '$ver'/" letsencrypt/__init__.py

# interactive user input
git add -p letsencrypt $SUBPKGS letsencrypt-compatibility-test

git add -p letsencrypt $SUBPKGS # interactive user input
}

SetVersion "$version"
git commit --gpg-sign="$RELEASE_GPG_KEY" -m "Release $version"
git tag --local-user "$RELEASE_GPG_KEY" \
Expand Down

0 comments on commit ecbe2a5

Please sign in to comment.