Skip to content
This repository has been archived by the owner on Jan 10, 2019. It is now read-only.

Commit

Permalink
Merge branch 'release/1.4'
Browse files Browse the repository at this point in the history
  • Loading branch information
Vedran Krivokuca committed Oct 22, 2014
2 parents f2adcd2 + bf2b1ca commit 850bc59
Show file tree
Hide file tree
Showing 5 changed files with 292 additions and 5 deletions.
13 changes: 13 additions & 0 deletions demo.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,19 @@ def main():
print (("SpamAssassin: %s" % (ver.check_spamassassin())))
print (("Consul: %s" % (ver.check_consul())))
print (("MIMEDefang: %s" % (ver.check_mimedefang())))
print (("Roundcube: %s" % (ver.check_roundcube())))
print (("Vagrant: %s" % (ver.check_vagrant())))
print (("HAProxy: %s" % (ver.check_haproxy())))
print (("Monit: %s" % (ver.check_monit())))
print (("WordPress: %s" % (ver.check_wordpress())))
print (("Bacula: %s" % (ver.check_bacula())))
print (("Redis: %s" % (ver.check_redis())))
print (("unbound: %s" % (ver.check_unbound())))
print (("SOGo: %s" % (ver.check_sogo())))
print (("CouchDB: %s" % (ver.check_couchdb())))
print (("ownCloud: %s" % (ver.check_owncloud())))
print (("OpenSMTPD: %s" % (ver.check_opensmtpd())))
print (("PHP: %s" % (ver.check_php())))


def set_include_path():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
from distutils.core import setup

setup(name='software_versions',
version='1.3.0',
version='1.4.0',
description='Python module for pulling latest software versions from '
'the respective vendors\' web sites',
author='Vedran Krivokuca',
Expand Down
87 changes: 83 additions & 4 deletions software_versions/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@

STABLE_MYSQL_URL = "http://www.mysql.com/downloads/mysql/"
STABLE_MYSQL_PATTERN = \
r'<h1>MySQL Community Server (.*?)</h1>'
r'<h1>MySQL Community Server (.*?)\s</h1>'

STABLE_PROFTPD_URL = "http://www.proftpd.org/"
STABLE_PROFTPD_PATTERN = \
Expand Down Expand Up @@ -125,13 +125,80 @@

STABLE_CONSUL_URL = "http://www.consul.io/downloads.html"
STABLE_CONSUL_PATTERN = \
r'Below are all available downloads for the latest version of Consul ' \
r'\((.*?)\)'
r'<h2 class="os-name">Linux</h2>.*?' \
r'<li><a href="https://dl.bintray.com/mitchellh/consul/' \
r'(.*?)_linux_386.zip">32-bit</a></li>'

STABLE_MIMEDEFANG_URL = "http://www.mimedefang.org/"
STABLE_MIMEDEFANG_PATTERN = \
r'<span class="field-content">Release (.*?)</span>'

STABLE_ROUNDCUBE_URL = "http://roundcube.net/download/"
STABLE_ROUNDCUBE_PATTERN = \
r'<td class="dlversion"><strong>Complete</Strong>: (.*?)</td>'

STABLE_VAGRANT_URL = "http://www.vagrantup.com/downloads.html"
STABLE_VAGRANT_PATTERN = \
r'<p> Below are all available downloads for the latest version of ' \
r'Vagrant \((.*?)\)'

STABLE_HAPROXY_URL = "http://www.haproxy.org/#down"
STABLE_HAPROXY_PATTERN = \
r'<td>.*?-stable</td>.*?' \
r'<td><a href="/download/.*?/src/haproxy-.*?.tar.gz">(.*?)</a></td>'

STABLE_MONIT_URL = "http://mmonit.com/monit/#download"
STABLE_MONIT_PATTERN = \
r'<div class="col-sm-8 col-sm-offset-2">.*?' \
r'<h3>Monit (.*?) Downloads</h3>'

STABLE_WORDPRESS_URL = "https://wordpress.org/download/"
STABLE_WORDPRESS_PATTERN = \
r'<p class="intro">The latest stable release of WordPress ' \
r'\(Version (.*?)\)'

STABLE_BACULA_URL = "http://sourceforge.net/projects/bacula/files/bacula/"
STABLE_BACULA_PATTERN = \
r'<div id="files"><div class="download-bar">Looking for the latest ' \
r'version\? <strong>.*?' \
r'<a href="/projects/bacula/files/latest/download\?source=files" ' \
r'title="/bacula/.*?/bacula-(.*?).tar.gz'

STABLE_REDIS_URL = "http://redis.io/download"
STABLE_REDIS_PATTERN = \
r'<td>(.*?)</td>.*?' \
r'<td>Stable</td>'

STABLE_UNBOUND_URL = "http://unbound.net/download.html"
STABLE_UNBOUND_PATTERN = \
r'<h2>Unbound Downloads</h2>.*?' \
r'The latest version of unbound \(currently (.*?)\)'

STABLE_SOGO_URL = "http://www.sogo.nu/downloads/backend.html"
STABLE_SOGO_PATTERN = \
r'<h2>Source Code</h2>.*?' \
r'id="downbutton">.*?SOGo-(.*?).tar.gz</a><br/>'

STABLE_COUCHDB_URL = "http://couchdb.apache.org/"
STABLE_COUCHDB_PATTERN = \
r'<div class="wrap download-pane">.*?' \
r'<h2 class="icon icon-download">Download CouchDB (.*?)</h2>'

STABLE_OWNCLOUD_URL = "https://owncloud.org/install/"
STABLE_OWNCLOUD_PATTERN = \
r'<h3><strong>Install ownCloud Server</strong>.*?' \
r'<p>Latest stable version: (.*?)\s\('

STABLE_OPENSMTPD_URL = "https://opensmtpd.org/"
STABLE_OPENSMTPD_PATTERN = \
r'<a href="/announces/release-.*?.txt">OpenSMTPD (.*?)</a> released'

STABLE_PHP_URL = "http://php.net/"
STABLE_PHP_PATTERN = \
r"<li><a class='download-link' href='/downloads.php#v.*?'>(.*?)</a>" \
r"<span class='dot'>&middot;</span><a class='notes' " \
r"href='/ChangeLog-5.php#.*?'>Release Notes</a></li>"

__all__ = [
"STABLE_SENDMAIL_URL", "STABLE_SENDMAIL_PATTERN",
"STABLE_BIND_URL", "STABLE_BIND_PATTERN",
Expand Down Expand Up @@ -160,5 +227,17 @@
"STABLE_MONGODB_URL", "STABLE_MONGODB_PATTERN",
"STABLE_SPAMASSASSIN_URL", "STABLE_SPAMASSASSIN_PATTERN",
"STABLE_CONSUL_URL", "STABLE_CONSUL_PATTERN",
"STABLE_MIMEDEFANG_URL", "STABLE_MIMEDEFANG_PATTERN"
"STABLE_MIMEDEFANG_URL", "STABLE_MIMEDEFANG_PATTERN",
"STABLE_VAGRANT_URL", "STABLE_VAGRANT_PATTERN",
"STABLE_HAPROXY_URL", "STABLE_HAPROXY_PATTERN",
"STABLE_MONIT_URL", "STABLE_MONIT_PATTERN",
"STABLE_WORDPRESS_URL", "STABLE_WORDPRESS_PATTERN",
"STABLE_BACULA_URL", "STABLE_BACULA_PATTERN",
"STABLE_REDIS_URL", "STABLE_REDIS_PATTERN",
"STABLE_UNBOUND_URL", "STABLE_UNBOUND_PATTERN",
"STABLE_SOGO_URL", "STABLE_SOGO_PATTERN",
"STABLE_COUCHDB_URL", "STABLE_COUCHDB_PATTERN",
"STABLE_OWNCLOUD_URL", "STABLE_OWNCLOUD_PATTERN",
"STABLE_OPENSMTPD_URL", "STABLE_OPENSMTPD_PATTERN",
"STABLE_PHP_URL", "STABLE_PHP_PATTERN"
]
130 changes: 130 additions & 0 deletions software_versions/versions.py
Original file line number Diff line number Diff line change
Expand Up @@ -308,6 +308,136 @@ def check_mimedefang():
return (__grep_out_info(url, pattern, only_first=True))


def check_roundcube():
'''
Checks Roundcube stable version from the website
'''
url = sftw.STABLE_ROUNDCUBE_URL
pattern = sftw.STABLE_ROUNDCUBE_PATTERN

return (__grep_out_info(url, pattern, only_first=True))


def check_vagrant():
'''
Checks Vagrant stable version from the website
'''
url = sftw.STABLE_VAGRANT_URL
pattern = sftw.STABLE_VAGRANT_PATTERN

return (__grep_out_info(url, pattern))


def check_haproxy():
'''
Checks HAProxy stable version from the website
'''
url = sftw.STABLE_HAPROXY_URL
pattern = sftw.STABLE_HAPROXY_PATTERN

return (__grep_out_info(url, pattern))


def check_monit():
'''
Checks Monit stable version from the website
'''
url = sftw.STABLE_MONIT_URL
pattern = sftw.STABLE_MONIT_PATTERN

return (__grep_out_info(url, pattern))


def check_wordpress():
'''
Checks WordPress stable version from the website
'''
url = sftw.STABLE_WORDPRESS_URL
pattern = sftw.STABLE_WORDPRESS_PATTERN

return (__grep_out_info(url, pattern))


def check_bacula():
'''
Checks Bacula stable version from the website
'''
url = sftw.STABLE_BACULA_URL
pattern = sftw.STABLE_BACULA_PATTERN

return (__grep_out_info(url, pattern))


def check_redis():
'''
Checks Redis stable version from the website
'''
url = sftw.STABLE_REDIS_URL
pattern = sftw.STABLE_REDIS_PATTERN

return (__grep_out_info(url, pattern))


def check_unbound():
'''
Checks unbound stable version from the website
'''
url = sftw.STABLE_UNBOUND_URL
pattern = sftw.STABLE_UNBOUND_PATTERN

return (__grep_out_info(url, pattern))


def check_sogo():
'''
Checks SOGo stable version from the website
'''
url = sftw.STABLE_SOGO_URL
pattern = sftw.STABLE_SOGO_PATTERN

return (__grep_out_info(url, pattern))


def check_couchdb():
'''
Checks CouchDB stable version from the website
'''
url = sftw.STABLE_COUCHDB_URL
pattern = sftw.STABLE_COUCHDB_PATTERN

return (__grep_out_info(url, pattern))


def check_owncloud():
'''
Checks ownCloud stable version from the website
'''
url = sftw.STABLE_OWNCLOUD_URL
pattern = sftw.STABLE_OWNCLOUD_PATTERN

return (__grep_out_info(url, pattern))


def check_opensmtpd():
'''
Checks OpenSMTPD stable version from the website
'''
url = sftw.STABLE_OPENSMTPD_URL
pattern = sftw.STABLE_OPENSMTPD_PATTERN

return (__grep_out_info(url, pattern))


def check_php():
'''
Checks PHP stable version from the website
'''
url = sftw.STABLE_PHP_URL
pattern = sftw.STABLE_PHP_PATTERN

return (__grep_out_info(url, pattern))


def __grep_out_info(
url, pattern, match_number=1, recursive=False, multiline=False,
only_first=False, greedy=False
Expand Down
65 changes: 65 additions & 0 deletions unittest/versions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,71 @@ def test_mimedefang(self):
self.__test_version(ver.check_mimedefang()) \
)

def test_roundcube(self):
self.assertTrue( \
self.__test_version(ver.check_roundcube()) \
)

def test_vagrant(self):
self.assertTrue( \
self.__test_version(ver.check_vagrant()) \
)

def test_haproxy(self):
self.assertTrue( \
self.__test_version(ver.check_haproxy()) \
)

def test_monit(self):
self.assertTrue( \
self.__test_version(ver.check_monit()) \
)

def test_wordpress(self):
self.assertTrue( \
self.__test_version(ver.check_wordpress()) \
)

def test_bacula(self):
self.assertTrue( \
self.__test_version(ver.check_bacula()) \
)

def test_redis(self):
self.assertTrue( \
self.__test_version(ver.check_redis()) \
)

def test_unbound(self):
self.assertTrue( \
self.__test_version(ver.check_unbound()) \
)

def test_sogo(self):
self.assertTrue( \
self.__test_version(ver.check_sogo()) \
)

def test_couchdb(self):
self.assertTrue( \
self.__test_version(ver.check_couchdb()) \
)

def test_owncloud(self):
self.assertTrue( \
self.__test_version(ver.check_owncloud()) \
)

def test_opensmtpd(self):
self.assertTrue( \
self.__test_version(ver.check_opensmtpd()) \
)

def test_php(self):
self.assertTrue( \
self.__test_version(ver.check_php()) \
)

def __test_version(self, input_values=None):

if (input_values):
Expand Down

0 comments on commit 850bc59

Please sign in to comment.