kopia lustrzana https://github.com/NanoVNA-Saver/nanovna-saver
Simplify the in-source launcher script (#660)
The nanovna-saver.py script is ignored by setup.cfg, its only purpose is to test the version in the source directory. According to https://setuptools.pypa.io/en/latest/history.html, pkg_resources.py2warn has been removed from setuptools in 2020pull/662/head
rodzic
eff83097f8
commit
21ba0ef665
|
@ -16,23 +16,23 @@
|
||||||
# You should have received a copy of the GNU General Public License
|
# You should have received a copy of the GNU General Public License
|
||||||
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
# along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
|
|
||||||
from contextlib import suppress
|
# This launcher is ignored by setuptools. Its only purpose is direct
|
||||||
import os
|
# execution from a source tree.
|
||||||
|
|
||||||
# noinspection PyUnresolvedReferences
|
import os.path
|
||||||
with suppress(ImportError):
|
import sys
|
||||||
# pylint: disable=no-name-in-module,import-error,unused-import
|
|
||||||
# pyright: reportMissingImports=false
|
|
||||||
import pkg_resources.py2_warn
|
|
||||||
|
|
||||||
try:
|
# Ignore the current working directory.
|
||||||
from NanoVNASaver.__main__ import main
|
src = os.path.join(os.path.dirname(__file__), "src")
|
||||||
except ModuleNotFoundError:
|
|
||||||
import sys
|
|
||||||
|
|
||||||
sys.path.append(os.path.join(os.path.dirname(__file__), "src"))
|
# Ignore previously installed versions.
|
||||||
from NanoVNASaver.__main__ import main
|
sys.path.insert(0, src)
|
||||||
|
assert os.path.exists(src)
|
||||||
|
|
||||||
|
# pylint: disable-next=wrong-import-position
|
||||||
|
import NanoVNASaver.__main__
|
||||||
|
|
||||||
if __name__ == "__main__":
|
# The traditional test does not make sense here.
|
||||||
main()
|
assert __name__ == '__main__'
|
||||||
|
|
||||||
|
NanoVNASaver.__main__.main()
|
||||||
|
|
Ładowanie…
Reference in New Issue