From: biao716.wang Date: Tue, 26 Jul 2022 09:19:24 +0000 (+0900) Subject: apply python3 as interpreter X-Git-Tag: accepted/tools/devbase/tools/20250527.103804~50 X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=84daa071f167c20af625c6db93e620e0a9712dbc;p=tools%2Fmic.git apply python3 as interpreter Change-Id: I4c3c99132c7cfa8751fdcbc9742335e573c84b36 Signed-off-by: biao716.wang --- diff --git a/debian/control b/debian/control index 3c9e6db..52ed82a 100644 --- a/debian/control +++ b/debian/control @@ -2,7 +2,7 @@ Source: mic Section: devel Priority: extra Maintainer: Jian-feng Ding -Build-Depends: debhelper (>= 7.0.15), cdbs, python3,python-is-python3, python3-all, python3-dev, dh-python, python3-docutils +Build-Depends: debhelper (>= 7.0.15), cdbs, python3, python3-requests, python3-all, python3-dev, dh-python, python3-docutils Standards-Version: 3.8.0 Homepage: http://www.tizen.org @@ -10,13 +10,14 @@ Package: mic Architecture: all Depends: ${misc:Depends}, ${python3:Depends}, rpm, - python-is-python3, python3-rpm, python3-urlgrabber, python3-requests, + python3-distro, cpio, bzip2, gzip, + yum Conflicts: mic2 Description: image creator for Linux distributions diff --git a/mic/3rdparty/pykickstart/sections.py b/mic/3rdparty/pykickstart/sections.py index bdfca5b..70ba084 100644 --- a/mic/3rdparty/pykickstart/sections.py +++ b/mic/3rdparty/pykickstart/sections.py @@ -168,9 +168,9 @@ class ScriptSection(Section): The error message will direct you to where the cause of the failure is logged.""", version=FC4) op.add_argument("--interpreter", dest="interpreter", default="/bin/sh", - version=FC4, metavar="/usr/bin/python", help=""" + version=FC4, metavar="/usr/bin/python3", help=""" Allows you to specify a different scripting language, - such as Python. Replace /usr/bin/python with the + such as Python. Replace /usr/bin/python3 with the scripting language of your choice. """) op.add_argument("--log", "--logfile", dest="log", version=FC4, diff --git a/mic/bootstrap.py b/mic/bootstrap.py index 553db14..f1bd137 100644 --- a/mic/bootstrap.py +++ b/mic/bootstrap.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2009, 2010, 2011 Intel, Inc. # diff --git a/mic/chroot.py b/mic/chroot.py index 4706c05..d95e882 100644 --- a/mic/chroot.py +++ b/mic/chroot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2009, 2010, 2011 Intel, Inc. # diff --git a/mic/cmd_chroot.py b/mic/cmd_chroot.py index 1faa515..fd42d78 100755 --- a/mic/cmd_chroot.py +++ b/mic/cmd_chroot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # vim: ai ts=4 sts=4 et sw=4 # # Copyright (c) 2012 Intel, Inc. diff --git a/mic/cmd_create.py b/mic/cmd_create.py index c220d09..75270ec 100755 --- a/mic/cmd_create.py +++ b/mic/cmd_create.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # vim: ai ts=4 sts=4 et sw=4 # # Copyright (c) 2012 Intel, Inc. diff --git a/mic/conf.py b/mic/conf.py index aca1974..c864e8f 100755 --- a/mic/conf.py +++ b/mic/conf.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/mic/helpformat.py b/mic/helpformat.py index 10d6f72..799af46 100755 --- a/mic/helpformat.py +++ b/mic/helpformat.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # vim: ai ts=4 sts=4 et sw=4 # # Copyright (c) 2011 Intel, Inc. diff --git a/mic/imager/baseimager.py b/mic/imager/baseimager.py index cae0453..43ac5f9 100644 --- a/mic/imager/baseimager.py +++ b/mic/imager/baseimager.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2007 Red Hat Inc. # Copyright (c) 2009, 2010, 2011 Intel, Inc. diff --git a/mic/imager/fs.py b/mic/imager/fs.py index f2ccb78..0fd6b46 100644 --- a/mic/imager/fs.py +++ b/mic/imager/fs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/mic/imager/loop.py b/mic/imager/loop.py index cfa3602..8056ffb 100755 --- a/mic/imager/loop.py +++ b/mic/imager/loop.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/mic/imager/raw.py b/mic/imager/raw.py index 4701141..983e942 100755 --- a/mic/imager/raw.py +++ b/mic/imager/raw.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/mic/kickstart/__init__.py b/mic/kickstart/__init__.py index b2b4376..318b8bf 100755 --- a/mic/kickstart/__init__.py +++ b/mic/kickstart/__init__.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2007 Red Hat, Inc. # Copyright (c) 2009, 2010, 2011 Intel, Inc. diff --git a/mic/kickstart/custom_commands/desktop.py b/mic/kickstart/custom_commands/desktop.py index a2359b3..f69939b 100644 --- a/mic/kickstart/custom_commands/desktop.py +++ b/mic/kickstart/custom_commands/desktop.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2008, 2009, 2010 Intel, Inc. # diff --git a/mic/kickstart/custom_commands/installerfw.py b/mic/kickstart/custom_commands/installerfw.py index 01deb76..31d9136 100644 --- a/mic/kickstart/custom_commands/installerfw.py +++ b/mic/kickstart/custom_commands/installerfw.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2013 Intel, Inc. # diff --git a/mic/kickstart/custom_commands/micboot.py b/mic/kickstart/custom_commands/micboot.py index 66d1678..2fa5639 100644 --- a/mic/kickstart/custom_commands/micboot.py +++ b/mic/kickstart/custom_commands/micboot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2008, 2009, 2010 Intel, Inc. # diff --git a/mic/kickstart/custom_commands/partition.py b/mic/kickstart/custom_commands/partition.py index 341e8dc..69d0d13 100755 --- a/mic/kickstart/custom_commands/partition.py +++ b/mic/kickstart/custom_commands/partition.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Marko Saukko # diff --git a/mic/plugin.py b/mic/plugin.py index 88a3081..e8ad9e8 100644 --- a/mic/plugin.py +++ b/mic/plugin.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/mic/pluginbase.py b/mic/pluginbase.py index db438b6..0bb1bad 100644 --- a/mic/pluginbase.py +++ b/mic/pluginbase.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/mic/rt_util.py b/mic/rt_util.py index 856f795..43b15de 100644 --- a/mic/rt_util.py +++ b/mic/rt_util.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2009, 2010, 2011 Intel, Inc. # @@ -234,7 +234,7 @@ def sync_mic(bootstrap, binpth = '/usr/bin/mic', # correct python interpreter mic_cont = file(_path(binpth)).read() - mic_cont = "#!/usr/bin/python\n" + mic_cont + mic_cont = "#!/usr/bin/python3\n" + mic_cont with open(_path(binpth), 'w') as wf: wf.write(mic_cont) diff --git a/mic/utils/fs_related.py b/mic/utils/fs_related.py index eb13f22..35d49d2 100755 --- a/mic/utils/fs_related.py +++ b/mic/utils/fs_related.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2007, Red Hat, Inc. # Copyright (c) 2009, 2010, 2011 Intel, Inc. diff --git a/mic/utils/gpt_parser.py b/mic/utils/gpt_parser.py index 34dc436..5c770eb 100644 --- a/mic/utils/gpt_parser.py +++ b/mic/utils/gpt_parser.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2013 Intel, Inc. # diff --git a/mic/utils/grabber.py b/mic/utils/grabber.py index a87d5a4..afbd267 100644 --- a/mic/utils/grabber.py +++ b/mic/utils/grabber.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 # Copyright (c) 2014 Intel, Inc. # diff --git a/mic/utils/misc.py b/mic/utils/misc.py index 581765a..36294a3 100755 --- a/mic/utils/misc.py +++ b/mic/utils/misc.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2010, 2011 Intel Inc. # diff --git a/mic/utils/partitionedfs.py b/mic/utils/partitionedfs.py index 40f4a46..ddd29ee 100644 --- a/mic/utils/partitionedfs.py +++ b/mic/utils/partitionedfs.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2009, 2010, 2011 Intel, Inc. # Copyright (c) 2007, 2008 Red Hat, Inc. diff --git a/mic/utils/proxy.py b/mic/utils/proxy.py index 7cbdd40..af6ab3e 100644 --- a/mic/utils/proxy.py +++ b/mic/utils/proxy.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2010, 2011 Intel, Inc. # diff --git a/mic/utils/rpmmisc.py b/mic/utils/rpmmisc.py index 0f46950..b22e136 100644 --- a/mic/utils/rpmmisc.py +++ b/mic/utils/rpmmisc.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2008, 2009, 2010, 2011 Intel, Inc. # diff --git a/mic/utils/runner.py b/mic/utils/runner.py index 1b97f5b..56ca86f 100644 --- a/mic/utils/runner.py +++ b/mic/utils/runner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/packaging/mic.spec b/packaging/mic.spec index 8de484b..cf859a8 100755 --- a/packaging/mic.spec +++ b/packaging/mic.spec @@ -1,5 +1,3 @@ -%{!?python_sitelib: %define python_sitelib %(%{__python} -c "from distutils.sysconfig import get_python_lib; print get_python_lib()")} -%{!?python_version: %define python_version %(%{__python} -c "import sys; sys.stdout.write(sys.version[:3])")} %define rc_version 0 @@ -17,33 +15,29 @@ BuildArch: noarch URL: http://www.tizen.org Source0: %{name}_%{version}.tar.gz -Requires: python >= 2.6 +Requires: python3 >= 3.1 Requires: python3-urlgrabber >= 3.9.0 Requires: yum -Requires: python-requests +Requires: python3-requests %if 0%{?suse_version} || 0%{?tizen_version:1} -Requires: python-xml -%endif - -%if "%{?python_version}" < "2.7" -Requires: python-argparse +Requires: python3-xml %endif %if 0%{?tizen_version:1} -Requires: python-rpm +Requires: python3-rpm %else Requires: rpm-python %endif - +Requires: python3-distro Requires: cpio # not neccessary Requires: gzip Requires: bzip2 -BuildRequires: python-devel +BuildRequires: python3-devel %if ! 0%{?tizen_version:1} -BuildRequires: python-docutils +BuildRequires: python3-docutils %endif Obsoletes: mic2 @@ -61,15 +55,15 @@ an image. %setup -q -n %{name}-%{version} %build -CFLAGS="$RPM_OPT_FLAGS" %{__python} setup.py build +CFLAGS="$RPM_OPT_FLAGS" python3 setup.py build make man %install rm -rf $RPM_BUILD_ROOT %if 0%{?suse_version} -%{__python} setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix} +python3 setup.py install --root=$RPM_BUILD_ROOT --prefix=%{_prefix} %else -%{__python} setup.py install --root=$RPM_BUILD_ROOT -O1 +python3 setup.py install --root=$RPM_BUILD_ROOT -O1 %endif # install man page @@ -93,7 +87,7 @@ install -Dp -m0755 etc/zsh_completion.d/_%{name} %{buildroot}/%{_sysconfdir}/zsh %endif %dir %{_sysconfdir}/%{name} %config(noreplace) %{_sysconfdir}/%{name}/%{name}.conf -%{python_sitelib}/* +%{python3_sitelib}/* %dir %{_prefix}/lib/%{name} %{_prefix}/lib/%{name}/* %{_bindir}/mic diff --git a/plugins/backend/yumpkgmgr.py b/plugins/backend/yumpkgmgr.py index 86093d7..8a3b228 100644 --- a/plugins/backend/yumpkgmgr.py +++ b/plugins/backend/yumpkgmgr.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2007 Red Hat Inc. # Copyright (c) 2010, 2011 Intel, Inc. diff --git a/plugins/backend/zypppkgmgr.py b/plugins/backend/zypppkgmgr.py index 2411423..60a4a7d 100644 --- a/plugins/backend/zypppkgmgr.py +++ b/plugins/backend/zypppkgmgr.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2010, 2011 Intel, Inc. # diff --git a/plugins/hook/empty_hook.py b/plugins/hook/empty_hook.py index 397585d..25e5663 100644 --- a/plugins/hook/empty_hook.py +++ b/plugins/hook/empty_hook.py @@ -1,3 +1,3 @@ -#!/usr/bin/python +#!/usr/bin/python3 # TODO: plugin base for hooks diff --git a/plugins/imager/fs_plugin.py b/plugins/imager/fs_plugin.py index 70b0d6c..d08e3ff 100644 --- a/plugins/imager/fs_plugin.py +++ b/plugins/imager/fs_plugin.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/plugins/imager/loop_plugin.py b/plugins/imager/loop_plugin.py index ceaa351..beba62c 100644 --- a/plugins/imager/loop_plugin.py +++ b/plugins/imager/loop_plugin.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/plugins/imager/raw_plugin.py b/plugins/imager/raw_plugin.py index fa24583..bb6661c 100644 --- a/plugins/imager/raw_plugin.py +++ b/plugins/imager/raw_plugin.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt # # Copyright (c) 2011 Intel, Inc. # diff --git a/tests/pluginmgr_fixtures/backend/yumtest.py b/tests/pluginmgr_fixtures/backend/yumtest.py index 61ba220..8b428b8 100644 --- a/tests/pluginmgr_fixtures/backend/yumtest.py +++ b/tests/pluginmgr_fixtures/backend/yumtest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt from mic.pluginbase import BackendPlugin class Yum(BackendPlugin): diff --git a/tests/pluginmgr_fixtures/backend/zypptest.py b/tests/pluginmgr_fixtures/backend/zypptest.py index 6ebe1f3..8976ea5 100644 --- a/tests/pluginmgr_fixtures/backend/zypptest.py +++ b/tests/pluginmgr_fixtures/backend/zypptest.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt from mic.pluginbase import BackendPlugin class Zypp(BackendPlugin): diff --git a/tests/pluginmgr_fixtures/imager/fs_test.py b/tests/pluginmgr_fixtures/imager/fs_test.py index ced1ce2..e6c464b 100644 --- a/tests/pluginmgr_fixtures/imager/fs_test.py +++ b/tests/pluginmgr_fixtures/imager/fs_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt from mic.pluginbase import ImagerPlugin class FsPlugin(ImagerPlugin): diff --git a/tests/pluginmgr_fixtures/imager/loop_test.py b/tests/pluginmgr_fixtures/imager/loop_test.py index 5fb515c..ada6025 100644 --- a/tests/pluginmgr_fixtures/imager/loop_test.py +++ b/tests/pluginmgr_fixtures/imager/loop_test.py @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt from mic.pluginbase import ImagerPlugin class LoopPlugin(ImagerPlugin): diff --git a/tests/test_baseimager.py b/tests/test_baseimager.py index 752abbf..fe39e7d 100644 --- a/tests/test_baseimager.py +++ b/tests/test_baseimager.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os import sys diff --git a/tests/test_chroot.py b/tests/test_chroot.py index e9ae737..e31c36e 100644 --- a/tests/test_chroot.py +++ b/tests/test_chroot.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os import sys diff --git a/tests/test_configmgr.py b/tests/test_configmgr.py index 40d8d1c..d97c752 100644 --- a/tests/test_configmgr.py +++ b/tests/test_configmgr.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os import sys diff --git a/tests/test_pluginmgr.py b/tests/test_pluginmgr.py index 1a8751a..126a574 100644 --- a/tests/test_pluginmgr.py +++ b/tests/test_pluginmgr.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os import sys diff --git a/tests/test_proxy.py b/tests/test_proxy.py index 9655b58..3c9fe18 100644 --- a/tests/test_proxy.py +++ b/tests/test_proxy.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import unittest from mic.utils import proxy diff --git a/tests/test_runner.py b/tests/test_runner.py index 7136ee0..e481939 100644 --- a/tests/test_runner.py +++ b/tests/test_runner.py @@ -1,4 +1,4 @@ -#!/usr/bin/python +#!/usr/bin/python3 import os import sys diff --git a/tools/mic b/tools/mic index 74a11f0..968118d 100755 --- a/tools/mic +++ b/tools/mic @@ -1,4 +1,4 @@ -#!/usr/bin/python -tt +#!/usr/bin/python3 -tt #Copyright (c) 2011 Intel, Inc. #