pyglossary: enable cmd UI features (#455155)
This commit is contained in:
@@ -5,5 +5,6 @@
|
|||||||
python3.pkgs.toPythonApplication (
|
python3.pkgs.toPythonApplication (
|
||||||
python3.pkgs.pyglossary.override {
|
python3.pkgs.pyglossary.override {
|
||||||
enableGui = true;
|
enableGui = true;
|
||||||
|
enableCmd = true;
|
||||||
}
|
}
|
||||||
)
|
)
|
||||||
|
|||||||
@@ -2,4 +2,8 @@
|
|||||||
python3,
|
python3,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
python3.pkgs.toPythonApplication python3.pkgs.pyglossary
|
python3.pkgs.toPythonApplication (
|
||||||
|
python3.pkgs.pyglossary.override {
|
||||||
|
enableCmd = true;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
|||||||
@@ -21,6 +21,9 @@
|
|||||||
# for GUI only
|
# for GUI only
|
||||||
pygobject3,
|
pygobject3,
|
||||||
gtk3,
|
gtk3,
|
||||||
|
enableCmd ? false,
|
||||||
|
prompt-toolkit,
|
||||||
|
tqdm,
|
||||||
}:
|
}:
|
||||||
|
|
||||||
buildPythonPackage rec {
|
buildPythonPackage rec {
|
||||||
@@ -58,6 +61,10 @@ buildPythonPackage rec {
|
|||||||
]
|
]
|
||||||
++ lib.optionals enableGui [
|
++ lib.optionals enableGui [
|
||||||
pygobject3
|
pygobject3
|
||||||
|
]
|
||||||
|
++ lib.optionals enableCmd [
|
||||||
|
prompt-toolkit
|
||||||
|
tqdm
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = lib.optionals enableGui [
|
buildInputs = lib.optionals enableGui [
|
||||||
|
|||||||
@@ -1,93 +0,0 @@
|
|||||||
diff --git c/pyproject.toml w/pyproject.toml
|
|
||||||
index abfb59ac..8f9c2121 100644
|
|
||||||
--- c/pyproject.toml
|
|
||||||
+++ w/pyproject.toml
|
|
||||||
@@ -416,11 +416,10 @@ version = "5.1.1"
|
|
||||||
description = "A tool for converting dictionary files aka glossaries."
|
|
||||||
readme = "README.md"
|
|
||||||
authors = [{ name = "Saeed Rasooli", email = "saeed.gnu@gmail.com" }]
|
|
||||||
-license = { text = "GPLv3+" }
|
|
||||||
+license = "GPL-3.0-or-later"
|
|
||||||
keywords = ["dictionary", "glossary"]
|
|
||||||
classifiers = [
|
|
||||||
"Development Status :: 5 - Production/Stable",
|
|
||||||
- "License :: OSI Approved :: GNU General Public License v3 or later (GPLv3+)",
|
|
||||||
"Operating System :: OS Independent",
|
|
||||||
"Typing :: Typed",
|
|
||||||
"Programming Language :: Python :: 3.11",
|
|
||||||
@@ -430,6 +429,9 @@ classifiers = [
|
|
||||||
requires-python = ">= 3.11"
|
|
||||||
dependencies = []
|
|
||||||
|
|
||||||
+[project.scripts]
|
|
||||||
+pyglossary = "pyglossary.ui.main:main"
|
|
||||||
+
|
|
||||||
[project.optional-dependencies]
|
|
||||||
all = ["PyICU", "lxml", "beautifulsoup4"]
|
|
||||||
|
|
||||||
diff --git c/setup.py w/setup.py
|
|
||||||
index fd38a060..19df9ee3 100755
|
|
||||||
--- c/setup.py
|
|
||||||
+++ w/setup.py
|
|
||||||
@@ -8,8 +8,7 @@ import sys
|
|
||||||
from glob import glob
|
|
||||||
from os.path import dirname, exists, isdir, join
|
|
||||||
|
|
||||||
-from setuptools import setup
|
|
||||||
-from setuptools.command.install import install
|
|
||||||
+from setuptools import setup, find_packages
|
|
||||||
|
|
||||||
VERSION = "5.1.1"
|
|
||||||
log = logging.getLogger("root")
|
|
||||||
@@ -46,29 +45,6 @@ def getPipSafeVersion() -> str:
|
|
||||||
return VERSION
|
|
||||||
|
|
||||||
|
|
||||||
-class my_install(install):
|
|
||||||
- def run(self) -> None:
|
|
||||||
- install.run(self)
|
|
||||||
- if os.sep == "/":
|
|
||||||
- binPath = join(self.install_scripts, "pyglossary")
|
|
||||||
- log.info(f"creating script file {binPath!r}")
|
|
||||||
- if not exists(self.install_scripts):
|
|
||||||
- os.makedirs(self.install_scripts)
|
|
||||||
- # let it fail on wrong permissions.
|
|
||||||
- elif not isdir(self.install_scripts):
|
|
||||||
- raise OSError(
|
|
||||||
- "installation path already exists "
|
|
||||||
- f"but is not a directory: {self.install_scripts}",
|
|
||||||
- )
|
|
||||||
- open(binPath, "w", encoding="ascii").write("""#!/usr/bin/env -S python3 -O
|
|
||||||
-import sys
|
|
||||||
-from os.path import dirname
|
|
||||||
-sys.path.insert(0, dirname(__file__))
|
|
||||||
-from pyglossary.ui.main import main
|
|
||||||
-main()""")
|
|
||||||
- os.chmod(binPath, 0o755)
|
|
||||||
-
|
|
||||||
-
|
|
||||||
root_data_file_names = [
|
|
||||||
"about",
|
|
||||||
"LICENSE",
|
|
||||||
@@ -146,19 +122,14 @@ setup(
|
|
||||||
name="pyglossary",
|
|
||||||
version=getPipSafeVersion(),
|
|
||||||
python_requires=">=3.10.0",
|
|
||||||
- cmdclass={
|
|
||||||
- "install": my_install,
|
|
||||||
- },
|
|
||||||
description="A tool for converting dictionary files aka glossaries.",
|
|
||||||
long_description_content_type="text/markdown",
|
|
||||||
long_description=long_description,
|
|
||||||
author="Saeed Rasooli",
|
|
||||||
author_email="saeed.gnu@gmail.com",
|
|
||||||
- license="GPLv3+",
|
|
||||||
+ license="GPL-3.0-or-later",
|
|
||||||
url="https://github.com/ilius/pyglossary",
|
|
||||||
- packages=[
|
|
||||||
- "pyglossary",
|
|
||||||
- ],
|
|
||||||
+ packages=find_packages(),
|
|
||||||
entry_points={
|
|
||||||
"console_scripts": [
|
|
||||||
"pyglossary = pyglossary.ui.main:main",
|
|
||||||
Reference in New Issue
Block a user