[virt-tools-list] [virt-bootstrap][PATCH 3/7] Move sources up one level

Radostin Stoyanov rstoyanov1 at gmail.com
Tue Sep 5 17:43:14 UTC 2017



On 05/09/17 17:41, Cédric Bosdonnat wrote:
> For sdist to package both the tests and sources, move the sources
> up one level in the tree.
> ---
>  README.md                                                        | 2 +-
>  run                                                              | 2 +-
>  setup.py                                                         | 9 +++------
>  {src/virtBootstrap => virtBootstrap}/__init__.py                 | 0
>  {src/virtBootstrap => virtBootstrap}/progress.py                 | 0
>  {src/virtBootstrap => virtBootstrap}/sources/__init__.py         | 0
>  {src/virtBootstrap => virtBootstrap}/sources/docker_source.py    | 0
>  {src/virtBootstrap => virtBootstrap}/sources/file_source.py      | 0
>  .../sources/virt_builder_source.py                               | 0
>  {src/virtBootstrap => virtBootstrap}/utils.py                    | 0
>  {src/virtBootstrap => virtBootstrap}/virt_bootstrap.py           | 0
>  11 files changed, 5 insertions(+), 8 deletions(-)
>  rename {src/virtBootstrap => virtBootstrap}/__init__.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/progress.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/sources/__init__.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/sources/docker_source.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/sources/file_source.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/sources/virt_builder_source.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/utils.py (100%)
>  rename {src/virtBootstrap => virtBootstrap}/virt_bootstrap.py (100%)
>
> diff --git a/README.md b/README.md
> index ecb533e..40c2cc3 100644
> --- a/README.md
> +++ b/README.md
> @@ -20,7 +20,7 @@ To test changes without installing the package in your machine,
>  use the run script. For example to run virt-bootstrap, use a command
>  like the following one:
>  
> -    ./run src/virtBootstrap/virt_bootstrap.py --help
> +    ./run virtBootstrap/virt_bootstrap.py --help
>  
>  The following commands will be useful for anyone writing patches:
>  
> diff --git a/run b/run
> index 5112034..a333fb3 100755
> --- a/run
> +++ b/run
> @@ -16,5 +16,5 @@
>  # You should have received a copy of the GNU General Public License
>  # along with this program.  If not, see <http://www.gnu.org/licenses/>.
>  
> -export PYTHONPATH=$PWD/src:$PYTHONPATH
> +export PYTHONPATH=$PWD:$PYTHONPATH
>  $@
> diff --git a/setup.py b/setup.py
> index bca9955..1ed852f 100755
> --- a/setup.py
> +++ b/setup.py
> @@ -12,9 +12,7 @@ import sys
>  import subprocess
>  import setuptools
>  from setuptools.command.install import install
> -
> -# pylint: disable=import-error, wrong-import-position
> -sys.path.insert(0, 'src')  # noqa: E402
> +from setuptools.command.sdist import sdist
>  import virtBootstrap
>  
>  
> @@ -75,7 +73,7 @@ class CheckPylint(setuptools.Command):
>          """
>  
>          res = 0
> -        files = ' '.join(["setup.py", "src/virtBootstrap/*.py", "tests/*.py"])
> +        files = ' '.join(["setup.py", "virtBootstrap/*.py", "tests/*.py"])
>          output_format = "colorized" if sys.stdout.isatty() else "text"
>  
>          print(">>> Running pycodestyle ...")
> @@ -105,8 +103,7 @@ setuptools.setup(
>      url='https://github.com/virt-manager/virt-bootstrap',
>      # What does your project relate to?
>      keywords='virtualization container rootfs',
> -    package_dir={"": "src"},
> -    packages=setuptools.find_packages('src'),
> +    packages=setuptools.find_packages(),
>      test_suite='tests',
>      entry_points={
>          'console_scripts': [
> diff --git a/src/virtBootstrap/__init__.py b/virtBootstrap/__init__.py
> similarity index 100%
> rename from src/virtBootstrap/__init__.py
> rename to virtBootstrap/__init__.py
> diff --git a/src/virtBootstrap/progress.py b/virtBootstrap/progress.py
> similarity index 100%
> rename from src/virtBootstrap/progress.py
> rename to virtBootstrap/progress.py
> diff --git a/src/virtBootstrap/sources/__init__.py b/virtBootstrap/sources/__init__.py
> similarity index 100%
> rename from src/virtBootstrap/sources/__init__.py
> rename to virtBootstrap/sources/__init__.py
> diff --git a/src/virtBootstrap/sources/docker_source.py b/virtBootstrap/sources/docker_source.py
> similarity index 100%
> rename from src/virtBootstrap/sources/docker_source.py
> rename to virtBootstrap/sources/docker_source.py
> diff --git a/src/virtBootstrap/sources/file_source.py b/virtBootstrap/sources/file_source.py
> similarity index 100%
> rename from src/virtBootstrap/sources/file_source.py
> rename to virtBootstrap/sources/file_source.py
> diff --git a/src/virtBootstrap/sources/virt_builder_source.py b/virtBootstrap/sources/virt_builder_source.py
> similarity index 100%
> rename from src/virtBootstrap/sources/virt_builder_source.py
> rename to virtBootstrap/sources/virt_builder_source.py
> diff --git a/src/virtBootstrap/utils.py b/virtBootstrap/utils.py
> similarity index 100%
> rename from src/virtBootstrap/utils.py
> rename to virtBootstrap/utils.py
> diff --git a/src/virtBootstrap/virt_bootstrap.py b/virtBootstrap/virt_bootstrap.py
> similarity index 100%
> rename from src/virtBootstrap/virt_bootstrap.py
> rename to virtBootstrap/virt_bootstrap.py
We need to update the line

    sys.path.insert(0, '../src') # noqa: E402
to

    sys.path.insert(0, '..') # noqa: E402

in tests/__init__.py to ensure that the tests will be able to import the
virtBootstrap module correctly.

ACKed with this update
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://listman.redhat.com/archives/virt-tools-list/attachments/20170905/8ecf3b59/attachment.htm>


More information about the virt-tools-list mailing list