Commit Graph

133 Commits

Author SHA1 Message Date
Cole Robinson c01fbcc885 Rename pylintrc -> .pylintrc
Plain pylint calls pick that up as well

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:32 -04:00
Cole Robinson 62e7f1c521 spec: Move virt-manager.spec.in -> virt-manager.spec
Drop the VERSION templating. Tools today like packit and tito
work best when a working .spec file exists. The extra burden is
we need to update the version at release time, but that's no
big deal

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:32 -04:00
Cole Robinson b9dfd92bf0 setup: Force 'rpm' to output to the git dir
And modernize it to use subprocess and report error output

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:32 -04:00
Cole Robinson 4226a4c1d5 setup: Kill old test_* command infrastructure
pytest invocations are now preferred. Leave plain `./setup.py test`
as a stub that errors and points to pytest.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 16:00:32 -04:00
Cole Robinson e9b3ed509f tests: Add pytest conftest.py
Makes 'pytest' and 'pytest --cov' work for the standard tests.
uitests run with `pytest --uitests --cov=virtManager`.
test_urls.py, test_dist.py, test_inject.py need to be invoked like

pytest $PATH

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-17 14:57:03 -04:00
Cole Robinson 35bfdc26a6 setup: Use xgettext --add-comments=translators
So in the code we can prefix comments with 'translators:' before
translated strings to have them show up in .pot file output

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Cole Robinson 14f8d2ff7a setup: Tweak extract_messages
* Use long xgettext options
* Truncate .pot file upfront so every call uses --join-existing

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-07-11 19:18:38 -04:00
Pino Toscano 61b75ba0fb Handle AppStream files using gettext
Starting from version 0.19.6, gettext has native capabilities to extract
from, and merge back translations in AppStream files.

Hence, use xgettext to extract messages, and msgfmt to create AppStream
files with translations; because of this, there no more need to prefix
with underscore the tags to be translated.

Update the gettext required version in INSTALL.md.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-11 14:59:56 -04:00
Pino Toscano 33d8bc9ae2 Handle desktop files using gettext
Starting from version 0.19, gettext has native capabilities to extract
from, and merge back translations in desktop files.

Hence, use xgettext to extract messages, and msgfmt to create a desktop
file with translations; because of this, there no more need to prefix
with underscore the keys to be translated.

Update the gettext required version in INSTALL.md.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-11 14:59:56 -04:00
Pino Toscano a1f0e07cd9 setup: use msgmerge for updating translations
Switch from intltool to msgmerge to merge the translations to the
catalog, as it is much easier.

Remove the writing of the temporary POTFILES.in, as it is no more needed
now.

Also, since now gettext is used at installation time:
- mention the gettext requirement in INSTALL.md
- add the gettext BuildRequires in the RPM spec file

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-11 14:59:56 -04:00
Pino Toscano d306d7ef7c setup: add a extract_messages command
Add a separate command to extract the messages; this also changes the
way messages are extracted:
- keep using intltool for desktop and AppStream files
- use xgettext directly for Python sources, and UI files; this is way
  more flexible than intltool

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-11 14:59:56 -04:00
Pino Toscano fdc902e461 setup: split listing of .in sources for POTFILES
Extract them from _generate_potfiles_in() to an own
_generate_meta_potfiles_in() function.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-07-11 14:59:56 -04:00
Cole Robinson 01ccaf03be setup: Run codespell on more files
And fix the results

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-28 14:31:28 -05:00
Cole Robinson 3440d8c59d urlfetcher: move mock code to the testsuite
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 13:08:12 -05:00
Cole Robinson 49d16912c3 setup: Skip coverage report when tests are aborted or skipped
Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson e784376699 tests: Rename all test files to have test_ prefix
This will help for a possible future conversion to pytest

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson 78c8aef75e tests: Move all data directories to data/
This cleans up the file hierarchy a bit

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-27 06:57:37 -05:00
Cole Robinson 8fe0a208db Move virt-* code into their modules
This layout is closer to what most python modules have nowadays.
It also simplifies testing and static analysis setup.

Keep virt-* wrappers locally, for ease of running these commands
from a git checkout.

Adjust the wrapper binaries we install on via packaging to be
pure python, which makes things like running gdb easier.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-26 18:27:20 -05:00
Cole Robinson ee9f93074b Remove virt-convert
This was raised here:
https://www.redhat.com/archives/virt-tools-list/2019-June/msg00117.html

Quoting from that:

"""
virt-convert takes an ovf/ova or vmx file and spits
out libvirt XML. It started as a code drop a long time ago that could
translate back and forth between vmx, ovf, and virt-image, a long dead
appliance format. In 2014 I converted it to do vmx -> libvirt and ovf ->
libvirt which was a CLI breaking change, but I never heard a peep of a
complaint. It doesn't seem to do a particularly thorough job at its
intended goal, I've seen 2-3 bug reports in the past 5 years and
generally it doesn't seem to have any users. Let's kill it. If anyone
has the desire to keep it alive it could live as a separate project
that's a wrapper around virt-install but there's no compelling reason to
keep it in virt-manager.git IMO
"""

Nothing has changed since then, so here is the removal.

Signed-off-by: Cole Robinson <crobinso@redhat.com>
2020-01-24 17:04:29 -05:00
Pino Toscano 9b7c819c64 Install the AppStream file to the canonical location
The canonical location for AppStream XML files has been changed to
/usr/share/metainfo four years ago at least, with /usr/share/appdata
left as legacy location. It is time to switch to the right location.

Reviewed-by: Cole Robinson <crobinso@redhat.com>
Signed-off-by: Pino Toscano <ptoscano@redhat.com>
2020-01-14 12:40:44 -05:00
Cole Robinson c92693a276 setup: Remove dep on importing virtinst
Import BuildConfig directly from the source file using import hackery.
buildconfig.py is independent of virtinst code so it already does
the right thing. Add some checking to make sure this doesn't regress
in the future.

Drop the now unneeded RPM deps.
2019-06-17 13:18:50 -04:00
Cole Robinson 5ef458a428 setup: Undo previous file search changes
They were totally busted
2019-06-17 01:27:08 -04:00
Cole Robinson 1d256bccd0 setup: Use smarter py file searching 2019-06-17 00:12:31 -04:00
Cole Robinson 44cf01cee1 setup: Fix test_urls coverage testing
And exclude some error handling
2019-06-16 14:41:54 -04:00
Cole Robinson ab7b3c189f Move virtcli/cliconfig.py to virtinst/buildconfig.py
There's really no reason for the split, just contain it all
within virtinst for simplicity
2019-06-14 17:12:19 -04:00
Cole Robinson 361657ad15 virtinst: Add a lot of test code coverage
* Delete dead code
* Add tests for various device default code paths
* Rework certain conditions a bit so code coverage always hits them
2019-06-09 18:59:50 -04:00
Cole Robinson ae06ed7aaa setup: Omit progress.py from coverage output
Since it's copied code that we rarely touch
2019-06-09 11:36:07 -04:00
Cole Robinson d50187e65c setup: Make codespell an optional part of the 'pylint' target 2019-05-16 14:43:31 -04:00
Cole Robinson 3be238b03e tests: test_urls: Add --*libosinfo, --iso-only, --url-only
These are options that will help tweak the test_urls logic,
to help as we try to ensure libosinfo covers all the cases
we care about.
2019-03-24 12:32:03 -04:00
Cole Robinson 4b54b281b9 setup: Remove vestiges of test_urls --path option 2019-02-03 12:05:18 -05:00
Cole Robinson a9f818b44b pycodestyle: Only use format=pylint from setup.py
Don't force it on users who are running the tool manually
2019-01-30 17:25:14 -05:00
Cole Robinson 8502b84dbd Move tests.pycodestyle.cfg to setup.cfg
This makes manual pycodestyle calls pick up our project config
2019-01-30 17:25:14 -05:00
Cole Robinson 90603cdc6e Move tests/pylint.cfg to pylintrc
This makes manual pylint calls pick up our project config
2019-01-30 17:25:14 -05:00
Cole Robinson 73f07c54ee setup: Generate bashcompletion files in builddir 2018-12-18 14:23:01 -05:00
Lin Ma a2850f345b setup.py: Install the bash completion files
Signed-off-by: Lin Ma <lma@suse.com>
2018-12-18 11:20:35 -05:00
Radostin Stoyanov 5b1f6ad2b8 pylint: Don't exclude progress.py
Currently progress.py file was excluded from pylint/pycodestyle check
because the code was straight from python-urlgrabber and it was not
PEP8 compliant. The following patched resolve the code style issues.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-11-12 08:34:55 -05:00
Cole Robinson 88cacb0295 setup: Remove configure --openssh-askpass
For one, we don't offer to install it anymore because we dropped
packagekit stuff. But even having a single package here isn't
really the whole story because different desktops have their
own askpass providers, like Fedora has openssh-askpass for GNOME,
but ksshaskpass for KDE

So drop it all, make the error more generic, and point people
to setting up SSH keys too
2018-10-08 13:59:13 -04:00
Cole Robinson f1d169ad7b setup: Remove configure --{libvirt,kvm}-package-names
This was really only useful with packagekit integration, which
is now gone
2018-10-07 14:27:20 -04:00
Cole Robinson 7eaf036acf virtinst: Remove stable_defaults concept
This switch says: if we detect a rhel host, use special version
checks that match rhel backports. This pattern sucks. The way
forward is to have libvirt advertise the bits that are supported,
through domcapabilities. Then virt-manager/virtinst can react
as appropriate.
2018-10-06 19:45:51 -04:00
Cole Robinson c9f0641700 cliconfig: Remove --preferred-distros
It's less relevant with our new search based OS list
2018-10-06 12:33:15 -04:00
Cole Robinson e6738d9827 cliconfig: Remove --default-qemu-user
Libvirt has given us this info in capabilities for a long time,
this shouldn't matter anymore
2018-10-06 12:30:59 -04:00
Radostin Stoyanov bb06053a8a setup: Integrate codespell
Codespell is a tool for checking misspelled words in source code [1].
Integrating this tool will enable automated spell check of the code
base.

Usage example:
        ./setup.py codespell

[1] https://github.com/codespell-project/codespell

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-06-05 14:27:29 -04:00
Luca Weiss e9ba30a255 setup: Install files in new virtinst folders
In commits fe9ed23 and 3909c10 several files were moved to subfolder of
virtinst, but they are not covered by the existing glob in the setup.py
file. Fix that by adding those subfolders explicitely.
2018-04-12 10:15:51 +02:00
Daniel P. Berrangé 48e32b429d Fix copyright header to specify GPLv2 or later, not GPLv2 only.
The copyright headers in every file were chjanged in this previous commit

  commit b6dcee8eb7
  Author: Cole Robinson <crobinso@redhat.com>
  Date:   Tue Mar 20 15:00:02 2018 -0400

    Use consistent and minimal license header for every file

Where before this they said "

  "either version 2 of the License, or (at your option) any later version."

Now they just say

  "GNU GPLv2"

This fixes it to say "GNU GPLv2 or later" again.

Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
2018-04-04 16:51:37 -04:00
Cole Robinson bd891eb380 virtcli: Add python3 version check
Assume 3.4 is needed, we may support earlier but I doubt anyone
is going to get all the deps in place on a distro that old
2018-03-21 18:00:38 -04:00
Cole Robinson b6dcee8eb7 Use consistent and minimal license header for every file 2018-03-21 07:29:40 -04:00
Cole Robinson 465b04ea18 Remove gconf->gsettings conversion script
It was first released with v1.2.0 in May 2015. I think that's long
enough for people to have run the app and had their settings
converted.
2018-03-16 14:41:53 -04:00
Radostin Stoyanov a52c282ed3 pycodestyle: Use module instead of executable
The `pycodestyle-3` executable is provided by the
`python3-pycodestyle` rpm package.
On Debian the corresponding executable is called `pycodestyle3`.
Arch Linux uses Python 3 by default and `python2-pycodestyle`
package is used for the py2 version.

To get around this inconsistency, import the `pycodestyle` module and
call the corresponding methods. The implementation has similar
behaviour to what happens when `pycodestyle` [1] is executed from the
command-line.

[1] https://github.com/PyCQA/pycodestyle/blob/master/pycodestyle.py

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 16:04:18 -05:00
Radostin Stoyanov 4f7bc4f4e6 pylint: Use pylint.lint module
The `pylint-3` executable is provided by the python3-pylint rpm
package on Fedora.
For Debian the equivalent is `pylint3`.
On Arch Linux the default version of Python is 3.

Pylint lints for the version of Python it is running. Instead of
spawning an executable, import the `pylint.lint` module and call
`Run()`.

Signed-off-by: Radostin Stoyanov <rstoyanov1@gmail.com>
2018-03-03 15:59:05 -05:00
Cole Robinson 47afa912b3 setup: tests: Add --testverbose option
Can't use --verbose because it conflicts with setuptools options
2018-02-22 15:18:47 -05:00