diff --git a/Makefile b/Makefile index bd1c9cd79..6cbb2670e 100644 --- a/Makefile +++ b/Makefile @@ -2,6 +2,7 @@ PYTHON?=python3 PKG_INSTALL?=dnf L10N_REPOSITORY=git@github.com:storaged-project/blivet-weblate.git +L10N_BRANCH=master PKGNAME=blivet SPECFILE=python-blivet.spec @@ -36,7 +37,7 @@ potfile: # - commit pot file # - tell user to verify this file and push to the remote from the temp dir TEMP_DIR=$$(mktemp --tmpdir -d $(PKGNAME)-localization-XXXXXXXXXX) || exit 1 ; \ - git clone --depth 1 -b master -- $(L10N_REPOSITORY) $$TEMP_DIR || exit 2 ; \ + git clone --depth 1 -b $(L10N_BRANCH) -- $(L10N_REPOSITORY) $$TEMP_DIR || exit 2 ; \ cp po/$(PKGNAME).pot $$TEMP_DIR/ || exit 3 ; \ pushd $$TEMP_DIR ; \ git difftool --trust-exit-code -y -x "diff -u -I '^\"POT-Creation-Date: .*$$'" HEAD ./$(PKGNAME).pot &>/dev/null ; \ @@ -50,7 +51,7 @@ potfile: git commit -m "Update $(PKGNAME).pot" && \ popd && \ git submodule foreach git checkout -- blivet.pot ; \ - echo "Pot file updated for the localization repository $(L10N_REPOSITORY)" && \ + echo "Pot file updated for the localization repository $(L10N_REPOSITORY) branch $(L10N_BRANCH)" && \ echo "Please confirm and push:" && \ echo "$$TEMP_DIR" ; \ fi ; diff --git a/README.md b/README.md index bd2e2c67d..1f29f78c8 100644 --- a/README.md +++ b/README.md @@ -16,7 +16,7 @@ Blivet is available in Fedora repositories. You can install it using # dnf install python3-blivet -#### Daily builds (for Fedora) +#### Daily builds for Fedora Daily builds of Blivet are available in `@storage/blivet-daily` Copr repository. You can enable it using @@ -25,11 +25,15 @@ You can enable it using Daily builds of _libblockdev_ and _libbytesize_ are also in this repo. -#### OBS repository (for Ubuntu and Debian) +#### OBS repository for Ubuntu and Debian Packages for Debian (testing and unstable) and Ubuntu (19.04 and newer) are available through the Open Build Service. Instructions for adding the repository are available [here](https://software.opensuse.org/download.html?project=home:vtrefny&package=python3-blivet). +#### Copr repository for openSUSE, Mageia and OpenMandriva + +Packages for openSUSE Tumbleweed, Mageia (8 and newer) and OpenMandriva (Cooker and Rolling) are available in our [blivet-stable Copr repository](https://copr.fedorainfracloud.org/coprs/g/storage/blivet-stable/). + #### PyPI Blivet is also available through the [Python Package Index](https://pypi.org/project/blivet/). diff --git a/blivet/devices/btrfs.py b/blivet/devices/btrfs.py index 21979e307..3b9374fcd 100644 --- a/blivet/devices/btrfs.py +++ b/blivet/devices/btrfs.py @@ -349,7 +349,7 @@ def list_subvolumes(self, snapshots_only=False): else: self._get_default_subvolume_id() - except errors.FSError as e: + except errors.FSError: pass return subvols diff --git a/blivet/formats/fs.py b/blivet/formats/fs.py index 23c6f968a..299c1a440 100644 --- a/blivet/formats/fs.py +++ b/blivet/formats/fs.py @@ -414,9 +414,9 @@ def _create(self, **kwargs): label=not self.relabels(), set_uuid=self.can_set_uuid(), nodiscard=self.can_nodiscard()) - except FSWriteLabelError as e: + except FSWriteLabelError: log.warning("Choosing not to apply label (%s) during creation of filesystem %s. Label format is unacceptable for this filesystem.", self.label, self.type) - except FSWriteUUIDError as e: + except FSWriteUUIDError: log.warning("Choosing not to apply UUID (%s) during" " creation of filesystem %s. UUID format" " is unacceptable for this filesystem.", diff --git a/blivet/i18n.py b/blivet/i18n.py index 0a1c94ec0..8e90bd5e9 100644 --- a/blivet/i18n.py +++ b/blivet/i18n.py @@ -46,7 +46,7 @@ def _get_translations(): # In Python 2, return the translated strings as unicode objects. # yes, pylint, the lambdas are necessary, because I want _get_translations() # evaluated on every call. -# pylint: disable=unnecessary-lambda +# pylint: disable=unnecessary-lambda,redundant-u-string-prefix if six.PY2: _ = lambda x: _get_translations().ugettext(x) if x != "" else u"" P_ = lambda x, y, z: _get_translations().ungettext(x, y, z) diff --git a/blivet/partitioning.py b/blivet/partitioning.py index 53f9cc3fe..f12ec3c9e 100644 --- a/blivet/partitioning.py +++ b/blivet/partitioning.py @@ -889,7 +889,7 @@ def allocate_partitions(storage, disks, partitions, freespace, boot_disk=None): req_size, _part.req_start_sector, _part.req_end_sector) - except ArithmeticError as e: + except ArithmeticError: log.debug("failed to allocate aligned partition " "for growth test") continue diff --git a/blivet/tasks/availability.py b/blivet/tasks/availability.py index 9813cd39a..b68a69f9c 100644 --- a/blivet/tasks/availability.py +++ b/blivet/tasks/availability.py @@ -247,18 +247,21 @@ def availability_errors(self, resource): return [] -class UnavailableMethod(Method): +class _UnavailableMethod(Method): """ Method that indicates a resource is unavailable. """ + def __init__(self, error_msg=None): + self.error_msg = error_msg or "always unavailable" + def availability_errors(self, resource): - return ["always unavailable"] + return [self.error_msg] -UnavailableMethod = UnavailableMethod() +UnavailableMethod = _UnavailableMethod() -class AvailableMethod(Method): +class _AvailableMethod(Method): """ Method that indicates a resource is available. """ @@ -266,7 +269,7 @@ def availability_errors(self, resource): return [] -AvailableMethod = AvailableMethod() +AvailableMethod = _AvailableMethod() def application(name): @@ -372,12 +375,15 @@ def available_resource(name): blockdev.LVMTechMode.MODIFY)}) BLOCKDEV_LVM_TECH = BlockDevMethod(BLOCKDEV_LVM) -BLOCKDEV_LVM_VDO = BlockDevTechInfo(plugin_name="lvm", - check_fn=blockdev.lvm_is_tech_avail, - technologies={blockdev.LVMTech.VDO: (blockdev.LVMTechMode.CREATE | - blockdev.LVMTechMode.REMOVE | - blockdev.LVMTechMode.QUERY)}) -BLOCKDEV_LVM_TECH_VDO = BlockDevMethod(BLOCKDEV_LVM_VDO) +if hasattr(blockdev.LVMTech, "VDO"): + BLOCKDEV_LVM_VDO = BlockDevTechInfo(plugin_name="lvm", + check_fn=blockdev.lvm_is_tech_avail, + technologies={blockdev.LVMTech.VDO: (blockdev.LVMTechMode.CREATE | + blockdev.LVMTechMode.REMOVE | + blockdev.LVMTechMode.QUERY)}) + BLOCKDEV_LVM_TECH_VDO = BlockDevMethod(BLOCKDEV_LVM_VDO) +else: + BLOCKDEV_LVM_TECH_VDO = _UnavailableMethod(error_msg="Installed version of libblockdev doesn't support LVM VDO technology") # libblockdev mdraid plugin required technologies and modes BLOCKDEV_MD_ALL_MODES = (blockdev.MDTechMode.CREATE | diff --git a/blivet/util.py b/blivet/util.py index bb9e19b7e..dee80bfab 100644 --- a/blivet/util.py +++ b/blivet/util.py @@ -438,8 +438,7 @@ def get_cow_sysfs_path(dev_path, dev_sysfsPath): cow_path = dev_path + "-cow" if not os.path.islink(cow_path): - raise RuntimeError("get_cow_sysfs_path: Could not find cow device for" % - (dev_path)) + raise RuntimeError("get_cow_sysfs_path: Could not find cow device for %s" % dev_path) # dev path for cow devices is actually a link to a dm device (e.g. /dev/dm-X) # we need the 'dm-X' name for sysfs_path (e.g. /sys/devices/virtual/block/dm-X) diff --git a/doc/conf.py b/doc/conf.py index e02b7a87a..29465cda8 100644 --- a/doc/conf.py +++ b/doc/conf.py @@ -41,8 +41,8 @@ master_doc = 'index' # General information about the project. -project = u'Blivet' -copyright = u'2013-2016, Red Hat, Inc.' # pylint: disable=redefined-builtin +project = 'Blivet' +copyright = '2013-2016, Red Hat, Inc.' # pylint: disable=redefined-builtin # The version info for the project you're documenting, acts as replacement for # |version| and |release|, also used in various other places throughout the @@ -186,8 +186,8 @@ # Grouping the document tree into LaTeX files. List of tuples # (source start file, target name, title, author, documentclass [howto/manual]). latex_documents = [ - ('index', 'Blivet.tex', u'Blivet Documentation', - u'David Lehman', 'manual'), + ('index', 'Blivet.tex', 'Blivet Documentation', + 'David Lehman', 'manual'), ] # The name of an image file (relative to this directory) to place at the top of @@ -216,8 +216,8 @@ # One entry per manual page. List of tuples # (source start file, name, description, authors, manual section). man_pages = [ - ('index', 'blivet', u'Blivet Documentation', - [u'David Lehman'], 1) + ('index', 'blivet', 'Blivet Documentation', + ['David Lehman'], 1) ] # If true, show URL addresses after external links. @@ -230,8 +230,8 @@ # (source start file, target name, title, author, # dir menu entry, description, category) texinfo_documents = [ - ('index', 'Blivet', u'Blivet Documentation', - u'David Lehman', 'Blivet', 'One line description of project.', + ('index', 'Blivet', 'Blivet Documentation', + 'David Lehman', 'Blivet', 'One line description of project.', 'Miscellaneous'), ] @@ -248,10 +248,10 @@ # -- Options for Epub output --------------------------------------------------- # Bibliographic Dublin Core info. -epub_title = u'Blivet' -epub_author = u'David Lehman' -epub_publisher = u'David Lehman' -epub_copyright = u'2013, David Lehman' +epub_title = 'Blivet' +epub_author = 'David Lehman' +epub_publisher = 'David Lehman' +epub_copyright = '2013, David Lehman' # The language of the text. It defaults to the language option # or en if the language is not set. diff --git a/tests/devices_test/device_properties_test.py b/tests/devices_test/device_properties_test.py index 8928707fb..dd43ed89c 100644 --- a/tests/devices_test/device_properties_test.py +++ b/tests/devices_test/device_properties_test.py @@ -104,8 +104,6 @@ def state_check(self, device, **kwargs): if k in kwargs: test_func = kwargs[k] if test_func is None: - import pdb - pdb.set_trace() getattr(device, k) else: test_func(device, k) diff --git a/tests/pylint/pylintrc b/tests/pylint/pylintrc index dbc7dd1b6..868372e23 100644 --- a/tests/pylint/pylintrc +++ b/tests/pylint/pylintrc @@ -74,6 +74,7 @@ disable=W0105, # String statement has no effect W0614, # Unused import %s from wildcard import I0011, # Locally disabling %s W0707, # Consider explicitly re-raising using the 'from' keyword + W1514, # Using open without explicitly specifying an encoding C, R diff --git a/tests/pylint/runpylint.py b/tests/pylint/runpylint.py index d8a8d3422..4508a5c6e 100755 --- a/tests/pylint/runpylint.py +++ b/tests/pylint/runpylint.py @@ -27,7 +27,7 @@ def __init__(self): FalsePositive(r"No value for argument 'member_count' in unbound method call$"), FalsePositive(r"No value for argument 'smallest_member_size' in unbound method call$"), FalsePositive(r"Parameters differ from overridden 'do_task' method$"), - FalsePositive(r"Bad option value '(subprocess-popen-preexec-fn|try-except-raise|environment-modify|arguments-renamed)'"), + FalsePositive(r"Bad option value '(subprocess-popen-preexec-fn|try-except-raise|environment-modify|arguments-renamed|redundant-u-string-prefix)'"), FalsePositive(r"Instance of '(Action.*Device|Action.*Format|Action.*Member|Device|DeviceAction|DeviceFormat|Event|ObjectID|PartitionDevice|StorageDevice|BTRFS.*Device|LoopDevice)' has no 'id' member$"), FalsePositive(r"Instance of 'GError' has no 'message' member") # overriding currently broken local pylint disable ]