Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify pip packaging and remove cruft files #79

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 0 additions & 11 deletions package/python/readme.rst

This file was deleted.

68 changes: 0 additions & 68 deletions package/python/setup.py

This file was deleted.

7 changes: 6 additions & 1 deletion package/readme.rst
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,10 @@ Packaging
While nerd-dictation is intended to run without the need for a build/packaging step,
some users may find it convenient.

- `Python's pip (setup-tools) <python/readme.rst>`_.
- Python's pip (setup-tools)

From the parent of the project directory, run:

pip3 install ./nerd-dictation

- `GNU Guix <guix/readme.rst>`_.
4 changes: 4 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,2 +1,6 @@
[build-system]
requires = ["setuptools"]
build-backend = "setuptools.build_meta"

[tool.black]
line-length = 119
57 changes: 57 additions & 0 deletions setup.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
#!/usr/bin/env python3
# SPDX-License-Identifier: GPL-2.0-or-later

import setuptools
import os
import re
import glob
import shutil

def read_file_as_utf8(filepath):
with open(filepath, encoding="utf-8") as fh:
return fh.read()


def main(base_dir):

doc_dir="share/doc/nerd-dictation"
fn="nerd-dictation.py"
doc_list=[(doc_dir,list(filter(re.compile(r'.*rst').match, os.listdir("./"))))]
for ex in glob.glob("examples/*/"):
doc_list.append((os.path.join(doc_dir,ex), [os.path.join(ex,fn)]))

if os.geteuid()!=0 and os.name=="posix":
config_dir=os.path.join(os.path.expanduser("~"),".config/nerd-dictation")
if not os.path.isdir(config_dir):
os.makedirs(config_dir)
shutil.copy("examples/default/nerd-dictation.py",config_dir)
# For cross-platform assistance, see: (pypi: appdirs) (github: platformdirs)
# For root install, first support /etc/nerd-dictation

setuptools.setup(
name="nerd-dictation",
version="0.0.0",
maintainer="Campbell Barton",
maintainer_email="[email protected]",
description="Offline Speech to Text for Desktop",
long_description=read_file_as_utf8("readme.rst"),
long_description_content_type="text/x-rst",
url="https://github.com/ideasman42/nerd-dictation",
classifiers=[
"Programming Language :: Python :: 3",
"Topic :: Office :: Productivity",
"Topic :: Accessibility :: Voice",
"Operating System :: POSIX :: Linux",
"License :: OSI Approved :: GPL v3.0",
],
scripts=["nerd-dictation"],
data_files=doc_list,
packages=[""],
package_data={"nerd-dictation": [""]},
install_requires=["vosk"],
python_requires=">=3.8",
)


if __name__ == "__main__":
main(os.path.abspath(os.path.dirname(__file__)))