From 38a29f4c71c124671546197ef10f9a77734ee198 Mon Sep 17 00:00:00 2001 From: pawel-kow Date: Fri, 26 Mar 2021 13:35:05 +0100 Subject: [PATCH 1/8] REFACTORING: versioning now in one place and in command line --- dyndns/__init__.py | 1 + dyndns/command_line.py | 4 ++++ setup.py | 3 ++- 3 files changed, 7 insertions(+), 1 deletion(-) diff --git a/dyndns/__init__.py b/dyndns/__init__.py index e69de29..4a29ceb 100644 --- a/dyndns/__init__.py +++ b/dyndns/__init__.py @@ -0,0 +1 @@ +__version__="0.0.9 \ No newline at end of file diff --git a/dyndns/command_line.py b/dyndns/command_line.py index e72b008..ee91cec 100644 --- a/dyndns/command_line.py +++ b/dyndns/command_line.py @@ -7,6 +7,7 @@ from dyndns import domain_update from dyndns import domain_status from dyndns import domain_remove +from . import __version__ def main(): @@ -14,6 +15,7 @@ def main(): parser.add_argument('action', choices=['setup', 'update', 'status', 'remove'], help="action to be performed on " "domain(s)") + parser.add_argument('--version', action='version', version='%(prog)s {version}'.format(version=__version__)) parser.add_argument('--config', type=str, default='settings.txt', help="config file path") parser.add_argument('--backup_file', default=None, help="backup file path for remove domain") parser.add_argument('--ignore-previous-ip', action='store_true', dest='ignore_previous_ip', @@ -35,6 +37,8 @@ def main(): ignore_ipv4 = "ipv4" not in args.protocols ignore_ipv6 = "ipv6" not in args.protocols + print('*** {} {} ***\n'.format(parser.prog, __version__)) + # validate domain if domain and not validators.domain(domain) is True: print("Domain is not valid.") diff --git a/setup.py b/setup.py index 7960ee4..a4f5817 100644 --- a/setup.py +++ b/setup.py @@ -1,12 +1,13 @@ #!/usr/bin/env python from setuptools import setup +import dyndns with open("README.md", "r") as fh: long_description = fh.read() setup( name = 'domain-connect-dyndns', - version = '0.0.8', + version=dyndns.__version__, description = 'Python client library for Dynamic DNS using Domain Connect', license = 'MIT', long_description=long_description, From f1a091329415e2fdeb01ff5fbd5af1b561a7deb9 Mon Sep 17 00:00:00 2001 From: pawel-kow Date: Fri, 26 Mar 2021 14:08:27 +0100 Subject: [PATCH 2/8] BUGFIX: one character missing --- dyndns/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/dyndns/__init__.py b/dyndns/__init__.py index 4a29ceb..92b28d4 100644 --- a/dyndns/__init__.py +++ b/dyndns/__init__.py @@ -1 +1 @@ -__version__="0.0.9 \ No newline at end of file +__version__="0.0.9" \ No newline at end of file From 0a56113579c26c48e07fd8954ea0da3491442a6f Mon Sep 17 00:00:00 2001 From: Pedro Rey Anca Date: Tue, 6 Apr 2021 14:40:11 +0200 Subject: [PATCH 3/8] BUGFIX: Ignore if webbrowser doesn't exist. Solves #46 --- dyndns/domain_setup.py | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) diff --git a/dyndns/domain_setup.py b/dyndns/domain_setup.py index 2910b9e..257b62a 100644 --- a/dyndns/domain_setup.py +++ b/dyndns/domain_setup.py @@ -1,6 +1,10 @@ import json import os.path -import webbrowser +try: + import webbrowser +except ModuleNotFoundError: + pass +import sys from builtins import input from domainconnect import DomainConnect, DomainConnectAsyncCredentials, TemplateNotSupportedException, \ @@ -43,8 +47,8 @@ def main(domain, protocols, settings='settings.txt'): params=params, redirect_uri='https://dynamicdns.domainconnect.org/ddnscode' ) - - webbrowser.open(context.asyncConsentUrl, autoraise=True) + if "webbrowser" in sys.modules: + webbrowser.open(context.asyncConsentUrl, autoraise=True) code = input("Please open\n{}\nand provide us the access code:".format(context.asyncConsentUrl)) tries = 1 From 94bb9f9c02f9e00d2d1be3c5dad27465520366b5 Mon Sep 17 00:00:00 2001 From: pawel-kow Date: Wed, 14 Apr 2021 16:48:25 +0200 Subject: [PATCH 4/8] SETUP: upgraded dependencies and split of requirements.txt --- CHANGELOG.md | 1 + requirements-test.txt | 21 +++++++++++++++++++++ requirements.txt | 31 ++++++++++++++++++------------- setup.py | 12 ++++++++++-- 4 files changed, 50 insertions(+), 15 deletions(-) create mode 100644 requirements-test.txt diff --git a/CHANGELOG.md b/CHANGELOG.md index 728325f..6ea01a2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] - BUGFIX: unhandled exception if not domainconnect record or no settings (Issue #32) +- SETUP: upgraded dependencies and split of requirements.txt ## [0.0.8] - 2020-06-30 diff --git a/requirements-test.txt b/requirements-test.txt new file mode 100644 index 0000000..e4fa1da --- /dev/null +++ b/requirements-test.txt @@ -0,0 +1,21 @@ +certifi==2020.12.5 +cffi==1.14.5 +chardet==4.0.0 +cryptography==3.3.2 +decorator==4.4.2 +dnspython==1.16.0 +domain-connect==0.0.9 +enum34==1.1.10 +future==0.18.2 +idna==2.10 +ipaddress==1.0.23 +linecache2==1.0.0 +publicsuffix==1.1.1 +publicsuffixlist==0.7.7 +pycparser==2.20 +requests==2.25.1 +six==1.15.0 +traceback2==1.4.0 +unittest2==1.1.0 +urllib3==1.26.4 +validators==0.14.2 diff --git a/requirements.txt b/requirements.txt index 65d7187..c8df437 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,13 +1,18 @@ -coverage==4.5.1 -coveralls==1.5.0 -domain-connect==0.0.7 -pytest==3.7.4 -unittest2==1.1.0 -validators~=0.14.0 -mock==2.0.0 -requests==2.21.0 -ipaddress==1.0.23; python_version < '3.3' - -argparse~=1.4.0 -dnspython~=1.16.0 -setuptools~=40.8.0 \ No newline at end of file +certifi==2020.12.5 +cffi==1.14.5 +chardet==4.0.0 +cryptography==3.3.2 +decorator==4.4.2 +dnspython==1.16.0 +domain-connect==0.0.9 +enum34==1.1.10 +future==0.18.2 +idna==2.10 +ipaddress==1.0.23 +publicsuffix==1.1.1 +publicsuffixlist==0.7.7 +pycparser==2.20 +requests==2.25.1 +six==1.15.0 +urllib3==1.26.4 +validators==0.14.2 diff --git a/setup.py b/setup.py index 7960ee4..93be1ff 100644 --- a/setup.py +++ b/setup.py @@ -4,6 +4,10 @@ with open("README.md", "r") as fh: long_description = fh.read() +test_deps = [ + 'unittest2 >= 1.1.0', +] + setup( name = 'domain-connect-dyndns', version = '0.0.8', @@ -27,10 +31,14 @@ 'validators >= 0.12.6', 'requests >= 2.21.0', 'dnspython >= 1.15.0', - 'domain-connect >= 0.0.7', + 'domain-connect >= 0.0.9', 'ipaddress >= 1.0.23;python_version<"3.3"', ], entry_points = { 'console_scripts': ['domain-connect-dyndns=dyndns.command_line:main'], - } + }, + tests_require=test_deps, + extras_require={ + 'test': test_deps, + }, ) From 801f0f34ce9702f51effea872b43b166e2e69c5a Mon Sep 17 00:00:00 2001 From: pawel-kow Date: Wed, 14 Apr 2021 16:48:43 +0200 Subject: [PATCH 5/8] TEST: fixed not working tests --- dyndns/tests/test_dyndns.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/dyndns/tests/test_dyndns.py b/dyndns/tests/test_dyndns.py index c47babc..5563f1e 100644 --- a/dyndns/tests/test_dyndns.py +++ b/dyndns/tests/test_dyndns.py @@ -16,7 +16,7 @@ def setUp(self): self.host = 'testing.' self.domain = 'connect.domains' self.expected_settings_keys = [ - 'access_token_expires_in', 'access_token', 'url_api', 'iat', 'provider_name', 'refresh_token' + 'access_token_expires_in', 'access_token', 'url_api', 'protocols', 'iat', 'provider_name', 'refresh_token' ] def tearDown(self): @@ -66,7 +66,7 @@ def test_update_domain(self): domain_setup.main(self.host + self.domain, ['ipv4']) assert (os.path.exists('settings.txt')), 'Settings file missing' result = domain_update.main(self.host + self.domain) - assert (result in ['A record up to date.', 'DNS record successfully updated.']), result + assert (result in ['All records up to date. No update required.', 'DNS record successfully updated.']), result if __name__ == '__main__': From 5864a2ae3812d5cdecb42e69458798ef53320b39 Mon Sep 17 00:00:00 2001 From: Pawel Kowalik Date: Wed, 14 Apr 2021 17:20:05 +0200 Subject: [PATCH 6/8] Update CHANGELOG.md --- CHANGELOG.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ea01a2..937e122 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -5,8 +5,11 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). ## [Unreleased] + +## [0.0.9] - 2021-04-14 - BUGFIX: unhandled exception if not domainconnect record or no settings (Issue #32) - SETUP: upgraded dependencies and split of requirements.txt +- BUGFIX: support when no webbrowser module (OpenWRT) ## [0.0.8] - 2020-06-30 From 60256c225af6d9d3a2ffbee8272be2b1ec845e48 Mon Sep 17 00:00:00 2001 From: Pawel Kowalik Date: Wed, 14 Apr 2021 17:20:32 +0200 Subject: [PATCH 7/8] Update CHANGELOG.md --- CHANGELOG.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/CHANGELOG.md b/CHANGELOG.md index 937e122..d8b2566 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -7,6 +7,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] ## [0.0.9] - 2021-04-14 + +### Changed - BUGFIX: unhandled exception if not domainconnect record or no settings (Issue #32) - SETUP: upgraded dependencies and split of requirements.txt - BUGFIX: support when no webbrowser module (OpenWRT) From 347ef141cb93431ccc174687f0305ee9df56c73e Mon Sep 17 00:00:00 2001 From: pawel-kow Date: Wed, 14 Apr 2021 17:31:00 +0200 Subject: [PATCH 8/8] CI/CD: updated test script --- .travis.yml | 13 ++++++++----- requirements-test.txt | 20 ++++++++++++++++++++ 2 files changed, 28 insertions(+), 5 deletions(-) diff --git a/.travis.yml b/.travis.yml index c286607..06b32b9 100644 --- a/.travis.yml +++ b/.travis.yml @@ -1,10 +1,12 @@ language: python python: -- '3.6' +- "2.7" +- "3.6" +- "3.7" +- "3.8" +- "3.9" install: -- pip install -r requirements.txt -- pip install pytest-cov -- pip install unittest2 + - pip install -r requirements-test.txt script: py.test --cov=dyndns --cov-config=.coveragerc deploy: provider: pypi @@ -12,4 +14,5 @@ deploy: password: secure: WbgltkoM1BZQJeTJpm7J/Drvh8vm/L4QPm7+aOIP4Xx2Sw71ClAvPYH5I2Q7Vi6hJ2/5W5jCuxuUaqPYAYWYQLpGp5QwyN7FQVlBbcW3N4aCWDKJKrgn20W0caBIKPVTTh/ZuYEbO52nuccZKOqtiLe3UpbSbSNQO5iDI3aNRhggchZUQ/rIVjESYHOmtyW4dAvfHaoCCOirnP2FNuGyD4f9vlz5kXCLMlVXzma+KMzIwNxL6WJrrzUboPbd47MIDswHHrbGGGB6DzUJP2Bz7d2WRDXQahd+spnr7TDH03K3zu23dv1hYluAGx7AUukYLpeFExRkUohpDF+oqqVHfkft13GRKi2hOHLAvqru27T+lAcfwA4E/KnOy2+7bzCW8lyTegkspBVgEb2dOBH/mxGoV2h01bBBO8Ev7QEt+Xnf+EfCgNnKWBZi4LqRCOU+4P8taSIJt5h0JqpxbXCfEIJjCG+hUUkmEd6suVOxFzA90gWLVUQS3T/4yMRxpCwykrJ66a1IWTgVP6nFvTRJkJ+KuRjsr7rI3hR8L07fDmyjfWNnyaQ/3sBWCXkH2BEJnGU6Z099NmqQ/vlIiVAmRUGG5rASf5cAxh4DkVbmqu98nxC/ZqEKAb3kjZX+lPy20j1L0+1UUOch0RMgtIlF9ipZtKCeROnml6xsvJ9V3Oc= on: - tags: true \ No newline at end of file + tags: true + skip_existing: true diff --git a/requirements-test.txt b/requirements-test.txt index e4fa1da..a37fcf6 100644 --- a/requirements-test.txt +++ b/requirements-test.txt @@ -1,21 +1,41 @@ +atomicwrites==1.4.0 +attrs==20.3.0 +backports.functools-lru-cache==1.6.4 certifi==2020.12.5 cffi==1.14.5 chardet==4.0.0 +colorama==0.4.4 +configparser==4.0.2 +contextlib2==0.6.0.post1 +coverage==5.5 cryptography==3.3.2 decorator==4.4.2 dnspython==1.16.0 domain-connect==0.0.9 enum34==1.1.10 +funcsigs==1.0.2 future==0.18.2 idna==2.10 +importlib-metadata==2.1.1 ipaddress==1.0.23 linecache2==1.0.0 +more-itertools==5.0.0 +packaging==20.9 +pathlib2==2.3.5 +pluggy==0.13.1 publicsuffix==1.1.1 publicsuffixlist==0.7.7 +py==1.10.0 pycparser==2.20 +pyparsing==2.4.7 +pytest==4.6.11 +pytest-cov==2.11.1 requests==2.25.1 +scandir==1.10.0 six==1.15.0 traceback2==1.4.0 unittest2==1.1.0 urllib3==1.26.4 validators==0.14.2 +wcwidth==0.2.5 +zipp==1.2.0