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

Commit

Permalink
Code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
bihanssen committed Oct 23, 2019
1 parent 7504c2a commit 30873ef
Showing 1 changed file with 12 additions and 8 deletions.
20 changes: 12 additions & 8 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@

install_package = True
try:
# If the version that is being installed is older than the one currently installed, suggest to use a virtual environment.
# If the version that is being installed is older than the one currently installed, suggest
# to use a virtual environment.

import pkg_resources
installed_packages = [d for d in pkg_resources.working_set]
Expand All @@ -73,17 +74,18 @@

if legacy_version:
valid_response = ["y", "yes"]
msg = "A newer version of nrfutil may already be installed. Consider using a separate virtual environment when installing legacy versions. \nProceed (y/N)? "
msg = ("A newer version of nrfutil may already be installed. Consider using a separate "
"virtual environment when installing legacy versions. \nProceed (y/N)? ")
print(msg)
sys.stdout.flush()
prompt = sys.stdin.readline().strip()
if(prompt.lower() not in valid_response):
install_package = False

except ImportError:
pass # pkg_resources not available.
except:
pass # Nrfutil is not already installed.
pass # pkg_resources not available.
except Exception:
pass # Nrfutil is not already installed.


# Exit program if user doesn't want to replace newer version.
Expand Down Expand Up @@ -120,6 +122,7 @@
with open("requirements.txt") as reqs_file:
reqs = reqs_file.readlines()


class NoseTestCommand(TestCommand):
def finalize_options(self):
TestCommand.finalize_options(self)
Expand All @@ -130,16 +133,17 @@ def run_tests(self):
import nose
nose.run_exit(argv=['nosetests', '--with-xunit', '--xunit-file=test-reports/unittests.xml'])


setup(
name="nrfutil",
version=version.NRFUTIL_VERSION,
license="Modified BSD License",
author = "Nordic Semiconductor ASA",
author="Nordic Semiconductor ASA",
url="https://github.com/NordicSemiconductor/pc-nrfutil",
description="Nordic Semiconductor nrfutil utility and Python library",
long_description=description,
packages=find_packages(exclude=["tests.*", "tests"]),
package_data = {
package_data={
'': ['../requirements.txt', 'thread/hex/ncp.hex', 'zigbee/hex/ota.hex',
'../libusb/x86/libusb-1.0.dll', '../libusb/x64/libusb-1.0.dll',
'../libusb/x64/libusb-1.0.dylib', '../libusb/LICENSE']
Expand Down Expand Up @@ -169,7 +173,7 @@ def run_tests(self):

'Programming Language :: Python :: 3.7',
],
keywords = 'nordic nrf51 nrf52 ble bluetooth dfu ota softdevice serialization nrfutil pc-nrfutil',
keywords='nordic nrf51 nrf52 ble bluetooth dfu ota softdevice serialization nrfutil pc-nrfutil',
cmdclass={
'test': NoseTestCommand
},
Expand Down

0 comments on commit 30873ef

Please sign in to comment.