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

Package plugins #74

Merged
merged 1 commit into from
Jul 19, 2024
Merged
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
2 changes: 1 addition & 1 deletion .github/workflows/pypi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

# build the package with flit
- name: Build package
run: pip install build && mv dool dool.py && python -m build
run: pip install build && packaging/pypi.py

# publish with https://docs.pypi.org/trusted-publishers/
- name: Publish package to PyPI
Expand Down
4 changes: 2 additions & 2 deletions dool
Original file line number Diff line number Diff line change
Expand Up @@ -47,8 +47,8 @@ __version__ = '1.3.3'
theme = { 'default': '' }

pluginpath = [
os.path.expanduser('~/.dool/'), # home + /.dool/
os.path.abspath(os.path.dirname(sys.argv[0])) + '/plugins/', # binary path + /plugins/
os.path.expanduser('~/.dool/'), # home + /.dool/
os.path.dirname(os.path.abspath(__file__)) + '/plugins/', # binary path + /plugins/
'/usr/share/dool/',
'/usr/local/share/dool/',
]
Expand Down
19 changes: 19 additions & 0 deletions packaging/pypi.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/usr/bin/env python3

import os
import pathlib
import sys

root_dir = pathlib.Path(__file__).parents[1]
dool_dir = root_dir / 'dool'
dool_dir.rename('__main__.py')
dool_dir.mkdir()
(root_dir / '__main__.py').rename(dool_dir / '__main__.py')
(root_dir / 'plugins').rename(dool_dir / 'plugins')

sys.path.append(root_dir.as_posix())
import dool.__main__

(dool_dir / '__init__.py').write_text(f'"""{dool.__main__.__doc__}"""\n\n__version__ = "{dool.__main__.__version__}"')

os.execlp('python3', 'python3', '-m', 'build')
3 changes: 2 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@ dynamic = ["version", "description"]
Home = "https://github.com/scottchiefbaker/dool"

[project.scripts]
dool = "dool:__main"
dool = "dool:__main__.__main"

[tool.flit.sdist]
include = ["dool/*"]
exclude = [".github/*", ".gitignore", "docs/*", "examples/*", "install.py", "packaging/*", "Makefile"]