From bc67a66de248b2bd51e23b34d59c9b00a880a528 Mon Sep 17 00:00:00 2001 From: Mark Gillard Date: Sun, 25 Apr 2021 23:34:18 +0300 Subject: [PATCH] renamed project to 'poxy' also: - made it installable! --- .gitmodules | 4 +- LICENSE => LICENSE.txt | 0 README.md | 2 + __main__.py | 9 +- dox/__init__.py | 7 -- dox/__main__.py | 9 -- poxy/__init__.py | 7 ++ poxy/__main__.py | 13 +++ .../data/cppreference-doxygen-web.tag.xml | 0 {dox => poxy}/data/emoji.json | 0 {dox => poxy}/data/jquery-3.6.0.slim.min.js | 0 {external => poxy/data}/mcss | 0 .../data/poxy-badge-c++03.svg | 0 .../data/poxy-badge-c++11.svg | 0 .../data/poxy-badge-c++14.svg | 0 .../data/poxy-badge-c++17.svg | 0 .../data/poxy-badge-c++20.svg | 0 .../data/poxy-badge-c++98.svg | 0 .../data/poxy-badge-license-apache_2.svg | 0 .../data/poxy-badge-license-bsd_2_clause.svg | 0 .../data/poxy-badge-license-bsd_3_clause.svg | 0 .../data/poxy-badge-license-gpl.svg | 0 .../data/poxy-badge-license-gpl_2.svg | 0 .../data/poxy-badge-license-gpl_3.svg | 0 .../data/poxy-badge-license-lgpl.svg | 0 .../data/poxy-badge-license-lgpl_2.svg | 0 .../data/poxy-badge-license-lgpl_2_1.svg | 0 .../data/poxy-badge-license-lgpl_3.svg | 0 .../data/poxy-badge-license-mit.svg | 0 .../data/poxy-github-icon.png | Bin dox/data/dox.css => poxy/data/poxy.css | 41 +------- dox/data/dox.js => poxy/data/poxy.js | 0 {dox => poxy}/doxygen.py | 6 +- {dox => poxy}/fixers.py | 20 ++-- {dox => poxy}/project.py | 44 ++++---- {dox => poxy}/run.py | 26 ++--- {dox => poxy}/soup.py | 6 +- {dox => poxy}/utils.py | 4 +- setup.py | 98 ++++++++++++++++++ 39 files changed, 182 insertions(+), 114 deletions(-) rename LICENSE => LICENSE.txt (100%) create mode 100644 README.md delete mode 100644 dox/__init__.py delete mode 100644 dox/__main__.py create mode 100644 poxy/__init__.py create mode 100644 poxy/__main__.py rename {dox => poxy}/data/cppreference-doxygen-web.tag.xml (100%) rename {dox => poxy}/data/emoji.json (100%) rename {dox => poxy}/data/jquery-3.6.0.slim.min.js (100%) rename {external => poxy/data}/mcss (100%) rename dox/data/dox-badge-c++03.svg => poxy/data/poxy-badge-c++03.svg (100%) rename dox/data/dox-badge-c++11.svg => poxy/data/poxy-badge-c++11.svg (100%) rename dox/data/dox-badge-c++14.svg => poxy/data/poxy-badge-c++14.svg (100%) rename dox/data/dox-badge-c++17.svg => poxy/data/poxy-badge-c++17.svg (100%) rename dox/data/dox-badge-c++20.svg => poxy/data/poxy-badge-c++20.svg (100%) rename dox/data/dox-badge-c++98.svg => poxy/data/poxy-badge-c++98.svg (100%) rename dox/data/dox-badge-license-apache_2.svg => poxy/data/poxy-badge-license-apache_2.svg (100%) rename dox/data/dox-badge-license-bsd_2_clause.svg => poxy/data/poxy-badge-license-bsd_2_clause.svg (100%) rename dox/data/dox-badge-license-bsd_3_clause.svg => poxy/data/poxy-badge-license-bsd_3_clause.svg (100%) rename dox/data/dox-badge-license-gpl.svg => poxy/data/poxy-badge-license-gpl.svg (100%) rename dox/data/dox-badge-license-gpl_2.svg => poxy/data/poxy-badge-license-gpl_2.svg (100%) rename dox/data/dox-badge-license-gpl_3.svg => poxy/data/poxy-badge-license-gpl_3.svg (100%) rename dox/data/dox-badge-license-lgpl.svg => poxy/data/poxy-badge-license-lgpl.svg (100%) rename dox/data/dox-badge-license-lgpl_2.svg => poxy/data/poxy-badge-license-lgpl_2.svg (100%) rename dox/data/dox-badge-license-lgpl_2_1.svg => poxy/data/poxy-badge-license-lgpl_2_1.svg (100%) rename dox/data/dox-badge-license-lgpl_3.svg => poxy/data/poxy-badge-license-lgpl_3.svg (100%) rename dox/data/dox-badge-license-mit.svg => poxy/data/poxy-badge-license-mit.svg (100%) rename dox/data/dox-github-icon.png => poxy/data/poxy-github-icon.png (100%) rename dox/data/dox.css => poxy/data/poxy.css (92%) rename dox/data/dox.js => poxy/data/poxy.js (100%) rename {dox => poxy}/doxygen.py (96%) rename {dox => poxy}/fixers.py (96%) rename {dox => poxy}/project.py (97%) rename {dox => poxy}/run.py (98%) rename {dox => poxy}/soup.py (96%) rename {dox => poxy}/utils.py (96%) create mode 100644 setup.py diff --git a/.gitmodules b/.gitmodules index 3620300..6df4d78 100644 --- a/.gitmodules +++ b/.gitmodules @@ -1,3 +1,3 @@ -[submodule "external/mcss"] - path = external/mcss +[submodule "poxy/data/mcss"] + path = poxy/data/mcss url = https://github.com/marzer/m.css.git diff --git a/LICENSE b/LICENSE.txt similarity index 100% rename from LICENSE rename to LICENSE.txt diff --git a/README.md b/README.md new file mode 100644 index 0000000..744e75c --- /dev/null +++ b/README.md @@ -0,0 +1,2 @@ +# poxy +Documentation generator for C++ based on Doxygen and [mosra/m.css](https://mcss.mosra.cz/). diff --git a/__main__.py b/__main__.py index b58bc86..4a13336 100644 --- a/__main__.py +++ b/__main__.py @@ -1,9 +1,10 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT -from dox import main +from poxy import main -main() +if __name__ == '__main__': + main() diff --git a/dox/__init__.py b/dox/__init__.py deleted file mode 100644 index 84cbfc8..0000000 --- a/dox/__init__.py +++ /dev/null @@ -1,7 +0,0 @@ -#!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. -# Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. -# SPDX-License-Identifier: MIT - -from .run import run, main diff --git a/dox/__main__.py b/dox/__main__.py deleted file mode 100644 index cdea9db..0000000 --- a/dox/__main__.py +++ /dev/null @@ -1,9 +0,0 @@ -#!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. -# Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. -# SPDX-License-Identifier: MIT - -from run import main - -main() diff --git a/poxy/__init__.py b/poxy/__init__.py new file mode 100644 index 0000000..55a7ef9 --- /dev/null +++ b/poxy/__init__.py @@ -0,0 +1,7 @@ +#!/usr/bin/env python3 +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + +from .run import run, main diff --git a/poxy/__main__.py b/poxy/__main__.py new file mode 100644 index 0000000..f8840a1 --- /dev/null +++ b/poxy/__main__.py @@ -0,0 +1,13 @@ +#!/usr/bin/env python3 +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. +# SPDX-License-Identifier: MIT + +try: + from poxy.run import main +except: + from run import main + +if __name__ == '__main__': + main() diff --git a/dox/data/cppreference-doxygen-web.tag.xml b/poxy/data/cppreference-doxygen-web.tag.xml similarity index 100% rename from dox/data/cppreference-doxygen-web.tag.xml rename to poxy/data/cppreference-doxygen-web.tag.xml diff --git a/dox/data/emoji.json b/poxy/data/emoji.json similarity index 100% rename from dox/data/emoji.json rename to poxy/data/emoji.json diff --git a/dox/data/jquery-3.6.0.slim.min.js b/poxy/data/jquery-3.6.0.slim.min.js similarity index 100% rename from dox/data/jquery-3.6.0.slim.min.js rename to poxy/data/jquery-3.6.0.slim.min.js diff --git a/external/mcss b/poxy/data/mcss similarity index 100% rename from external/mcss rename to poxy/data/mcss diff --git a/dox/data/dox-badge-c++03.svg b/poxy/data/poxy-badge-c++03.svg similarity index 100% rename from dox/data/dox-badge-c++03.svg rename to poxy/data/poxy-badge-c++03.svg diff --git a/dox/data/dox-badge-c++11.svg b/poxy/data/poxy-badge-c++11.svg similarity index 100% rename from dox/data/dox-badge-c++11.svg rename to poxy/data/poxy-badge-c++11.svg diff --git a/dox/data/dox-badge-c++14.svg b/poxy/data/poxy-badge-c++14.svg similarity index 100% rename from dox/data/dox-badge-c++14.svg rename to poxy/data/poxy-badge-c++14.svg diff --git a/dox/data/dox-badge-c++17.svg b/poxy/data/poxy-badge-c++17.svg similarity index 100% rename from dox/data/dox-badge-c++17.svg rename to poxy/data/poxy-badge-c++17.svg diff --git a/dox/data/dox-badge-c++20.svg b/poxy/data/poxy-badge-c++20.svg similarity index 100% rename from dox/data/dox-badge-c++20.svg rename to poxy/data/poxy-badge-c++20.svg diff --git a/dox/data/dox-badge-c++98.svg b/poxy/data/poxy-badge-c++98.svg similarity index 100% rename from dox/data/dox-badge-c++98.svg rename to poxy/data/poxy-badge-c++98.svg diff --git a/dox/data/dox-badge-license-apache_2.svg b/poxy/data/poxy-badge-license-apache_2.svg similarity index 100% rename from dox/data/dox-badge-license-apache_2.svg rename to poxy/data/poxy-badge-license-apache_2.svg diff --git a/dox/data/dox-badge-license-bsd_2_clause.svg b/poxy/data/poxy-badge-license-bsd_2_clause.svg similarity index 100% rename from dox/data/dox-badge-license-bsd_2_clause.svg rename to poxy/data/poxy-badge-license-bsd_2_clause.svg diff --git a/dox/data/dox-badge-license-bsd_3_clause.svg b/poxy/data/poxy-badge-license-bsd_3_clause.svg similarity index 100% rename from dox/data/dox-badge-license-bsd_3_clause.svg rename to poxy/data/poxy-badge-license-bsd_3_clause.svg diff --git a/dox/data/dox-badge-license-gpl.svg b/poxy/data/poxy-badge-license-gpl.svg similarity index 100% rename from dox/data/dox-badge-license-gpl.svg rename to poxy/data/poxy-badge-license-gpl.svg diff --git a/dox/data/dox-badge-license-gpl_2.svg b/poxy/data/poxy-badge-license-gpl_2.svg similarity index 100% rename from dox/data/dox-badge-license-gpl_2.svg rename to poxy/data/poxy-badge-license-gpl_2.svg diff --git a/dox/data/dox-badge-license-gpl_3.svg b/poxy/data/poxy-badge-license-gpl_3.svg similarity index 100% rename from dox/data/dox-badge-license-gpl_3.svg rename to poxy/data/poxy-badge-license-gpl_3.svg diff --git a/dox/data/dox-badge-license-lgpl.svg b/poxy/data/poxy-badge-license-lgpl.svg similarity index 100% rename from dox/data/dox-badge-license-lgpl.svg rename to poxy/data/poxy-badge-license-lgpl.svg diff --git a/dox/data/dox-badge-license-lgpl_2.svg b/poxy/data/poxy-badge-license-lgpl_2.svg similarity index 100% rename from dox/data/dox-badge-license-lgpl_2.svg rename to poxy/data/poxy-badge-license-lgpl_2.svg diff --git a/dox/data/dox-badge-license-lgpl_2_1.svg b/poxy/data/poxy-badge-license-lgpl_2_1.svg similarity index 100% rename from dox/data/dox-badge-license-lgpl_2_1.svg rename to poxy/data/poxy-badge-license-lgpl_2_1.svg diff --git a/dox/data/dox-badge-license-lgpl_3.svg b/poxy/data/poxy-badge-license-lgpl_3.svg similarity index 100% rename from dox/data/dox-badge-license-lgpl_3.svg rename to poxy/data/poxy-badge-license-lgpl_3.svg diff --git a/dox/data/dox-badge-license-mit.svg b/poxy/data/poxy-badge-license-mit.svg similarity index 100% rename from dox/data/dox-badge-license-mit.svg rename to poxy/data/poxy-badge-license-mit.svg diff --git a/dox/data/dox-github-icon.png b/poxy/data/poxy-github-icon.png similarity index 100% rename from dox/data/dox-github-icon.png rename to poxy/data/poxy-github-icon.png diff --git a/dox/data/dox.css b/poxy/data/poxy.css similarity index 92% rename from dox/data/dox.css rename to poxy/data/poxy.css index fa648ee..8e3cc21 100644 --- a/dox/data/dox.css +++ b/poxy/data/poxy.css @@ -61,12 +61,12 @@ article section.m-doc-details > div > h3:first-child background-color: #22272e; } -pre, code, .dox-enable-if > a +pre, code { font-family: 'Consolas', 'Source Code Pro', monospace; } -a.dox-external +a.poxy-external { font-weight: normal; } @@ -82,41 +82,6 @@ pre.m-console a:hover text-decoration: underline !important; } -.dox-enable-if -{ - margin-bottom: 2px; -} - -.dox-enable-if > * -{ - display: inline-block; - border-radius: 0.2rem; - background-clip: padding-box !important; - padding: 0px 2px; - text-decoration: none; -} - -.dox-enable-if > a -{ - white-space: nowrap; - font-size: 0.7rem; - font-weight: bold; - background-color: #858585; - color: #050505; -} - -.dox-enable-if > a:hover -{ - background-color: #747474; - color: initial; -} - -.dox-enable-if > span -{ - display: none; - padding-left: 2em; -} - @media screen and (min-width: 576px) { nav .m-thin @@ -127,7 +92,7 @@ pre.m-console a:hover nav .github { padding-left: 44px !important; - background-image: url("dox-github-icon.png"); + background-image: url("poxy-github-icon.png"); background-repeat: no-repeat; background-size: 25px 25px; background-position: -30px center; diff --git a/dox/data/dox.js b/poxy/data/poxy.js similarity index 100% rename from dox/data/dox.js rename to poxy/data/poxy.js diff --git a/dox/doxygen.py b/poxy/doxygen.py similarity index 96% rename from dox/doxygen.py rename to poxy/doxygen.py index d079bec..6e707b3 100644 --- a/dox/doxygen.py +++ b/poxy/doxygen.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT try: - from dox.utils import * + from poxy.utils import * except: from utils import * diff --git a/dox/fixers.py b/poxy/fixers.py similarity index 96% rename from dox/fixers.py rename to poxy/fixers.py index 1c4c8ae..e683ec9 100644 --- a/dox/fixers.py +++ b/poxy/fixers.py @@ -1,12 +1,12 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT try: - from dox.utils import * - import dox.soup as soup + from poxy.utils import * + import poxy.soup as soup except: from utils import * import soup @@ -161,7 +161,7 @@ class Modifiers1(_ModifiersBase): @classmethod def __substitute(cls, m, out): - return f'{m[1]}{m[2]}{m[3]}' + return f'{m[1]}{m[2]}{m[3]}' def __call__(self, doc, context): if doc.article_content is None: @@ -216,7 +216,7 @@ def __call__(self, doc, context): lastInserted = doc.new_tag('span', parent=end, string=match, - class_=f'dox-injected m-label {self._modifierClasses[match]}', + class_=f'poxy-injected m-label {self._modifierClasses[match]}', before=lastInserted ) lastInserted.insert_after(' ') @@ -572,7 +572,7 @@ class AutoDocLinks(object): @classmethod def __substitute(cls, m, uri): external = uri.startswith('http') - return rf'''{m[0]}''' + return rf'''{m[0]}''' def __call__(self, doc, context): if doc.article_content is None: @@ -589,9 +589,9 @@ def __call__(self, doc, context): for expr, uri in context.autolinks: if ((not link.has_attr('href') or link['href'] != uri) and expr.fullmatch(s)): link['href'] = uri - soup.set_class(link, ['m-doc', 'dox-injected']) + soup.set_class(link, ['m-doc', 'poxy-injected']) if uri.startswith('http'): - soup.add_class(link, 'dox-external') + soup.add_class(link, 'poxy-external') done = True changed = True break @@ -645,7 +645,7 @@ def __call__(self, doc, context): if 'target' not in anchor.attrs or anchor['target'] != '_blank': anchor['target'] = '_blank' changed = True - changed = soup.add_class(anchor, 'dox-external') or changed + changed = soup.add_class(anchor, 'poxy-external') or changed # do magic with godbolt.org links if self.__godbolt.fullmatch(href): diff --git a/dox/project.py b/poxy/project.py similarity index 97% rename from dox/project.py rename to poxy/project.py index fabb019..9daeb38 100644 --- a/dox/project.py +++ b/poxy/project.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT try: - from dox.utils import * + from poxy.utils import * except: from utils import * @@ -84,8 +84,8 @@ class _Defaults(object): r'DOXYGEN' : 1, r'__DOXYGEN__' : 1, r'__doxygen__' : 1, - r'__DOX__' : 1, - r'__dox__' : 1, + r'__POXY__' : 1, + r'__poxy__' : 1, r'__has_include(...)' : 0, r'__has_attribute(...)' : 0, r'__has_cpp_attribute(...)' : 999999, @@ -510,7 +510,7 @@ class _Defaults(object): } navbar = [r'files', r'groups', r'namespaces', r'classes'] aliases = { - # dox + # poxy r'cpp' : r'@code{.cpp}', r'ecpp' : r'@endcode', r'endcpp' : r'@endcode', @@ -907,12 +907,10 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, if 1: # environment - self.this_dir = Path(__file__).resolve().parent - self.verbose_value(r'Context.this_dir', self.this_dir) - self.data_dir = Path(self.this_dir, 'data') + self.package_dir = Path(__file__).resolve().parent + self.verbose_value(r'Context.package_dir', self.package_dir) + self.data_dir = Path(self.package_dir, r'data') self.verbose_value(r'Context.data_dir', self.data_dir) - self.dox_dir = self.this_dir.parent - self.verbose_value(r'Context.dox_dir', self.dox_dir) if output_dir is None: output_dir = Path.cwd() if not isinstance(output_dir, Path): @@ -942,8 +940,8 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, self.config_path = Path(str(config_path) + ".toml") elif config_path.is_dir(): input_dir = config_path - if Path(config_path, 'dox.toml').exists(): - self.config_path = Path(config_path, 'dox.toml') + if Path(config_path, 'poxy.toml').exists(): + self.config_path = Path(config_path, 'poxy.toml') elif Path(config_path, 'Doxyfile-mcss').exists(): self.doxyfile_path = Path(config_path, 'Doxyfile-mcss') elif Path(config_path, 'Doxyfile').exists(): @@ -954,8 +952,8 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, elif self.doxyfile_path is not None: input_dir = self.doxyfile_path.parent if input_dir is not None: - if self.config_path is None and Path(input_dir, 'dox.toml').exists(): - self.config_path = Path(input_dir, 'dox.toml') + if self.config_path is None and Path(input_dir, 'poxy.toml').exists(): + self.config_path = Path(input_dir, 'poxy.toml') if self.doxyfile_path is None and Path(input_dir, 'Doxyfile-mcss').exists(): self.doxyfile_path = Path(input_dir, 'Doxyfile-mcss') if self.doxyfile_path is None: @@ -981,7 +979,7 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, # m.css if mcss_dir is None: - mcss_dir = Path(self.dox_dir, 'external/mcss') + mcss_dir = Path(self.data_dir, r'mcss') if not isinstance(mcss_dir, Path): mcss_dir = Path(str(mcss_dir)) mcss_dir = mcss_dir.resolve() @@ -1027,12 +1025,12 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, badge = re.sub(r'(?:[.]0+)+$', '', spdx.lower()) # trailing .0, .0.0 etc badge = badge.strip(' \t-._:') # leading + trailing junk badge = re.sub(r'[:;!@#$%^&*\\|/,.<>?`~\[\]{}()_+\-= \t]+', '_', badge) # internal junk - badge = Path(self.data_dir, rf'dox-badge-license-{badge}.svg') - self.verbose(rf'Matching license {spdx} against badge file {badge.name}...') + badge = Path(self.data_dir, rf'poxy-badge-license-{badge}.svg') + self.verbose(rf"Finding badge SVG for license '{spdx}'...") if badge.exists(): self.verbose(rf'Badge file found at {badge}') extra_files.append(badge) - badges.append((self.license[r'spdx'], badge.spdx, self.license[r'uri'])) + badges.append((spdx, badge.name, uri)) self.verbose_value(r'Context.license', self.license) # project repo access level @@ -1070,7 +1068,7 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, else: raise Exception(rf"cpp: '{config['cpp']}' is not a valid cpp standard version") self.verbose_value(r'Context.cpp', self.cpp) - badge = rf'dox-badge-c++{str(self.cpp)[2:]}.svg' + badge = rf'poxy-badge-c++{str(self.cpp)[2:]}.svg' badges.append((rf'C++{str(self.cpp)[2:]}', badge, r'https://en.cppreference.com/w/cpp/compiler_support')) extra_files.append(Path(self.data_dir, badge)) @@ -1292,9 +1290,9 @@ def __init__(self, config_path, output_dir, threads, cleanup, verbose, mcss_dir, extra_files.append(Path(file)) # add built-ins to extra files - extra_files.append(Path(self.data_dir, r'dox.css')) - extra_files.append(Path(self.data_dir, r'dox.js')) - extra_files.append(Path(self.data_dir, r'dox-github-icon.png')) + extra_files.append(Path(self.data_dir, r'poxy.css')) + extra_files.append(Path(self.data_dir, r'poxy.js')) + extra_files.append(Path(self.data_dir, r'poxy-github-icon.png')) # add jquery self.jquery = Path(self.data_dir, r'jquery-3.6.0.slim.min.js') diff --git a/dox/run.py b/poxy/run.py similarity index 98% rename from dox/run.py rename to poxy/run.py index 283468c..8df2e5e 100644 --- a/dox/run.py +++ b/poxy/run.py @@ -1,15 +1,15 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT try: - from dox.utils import * - import dox.project as project - import dox.doxygen as doxygen - import dox.soup as soup - import dox.fixers as fixers + from poxy.utils import * + import poxy.project as project + import poxy.doxygen as doxygen + import poxy.soup as soup + import poxy.fixers as fixers except: from utils import * import project @@ -152,7 +152,7 @@ def _preprocess_doxyfile(context): df.append() df.append(r'#---------------------------------------------------------------------------') - df.append(r'# marzer/dox') + df.append(r'# marzer/poxy') df.append(r'#---------------------------------------------------------------------------') # apply regular doxygen settings @@ -289,9 +289,9 @@ def _preprocess_doxyfile(context): df.append(r'##! M_HTML_HEADER = ''\\') for k, v in context.meta_tags.items(): df.append(rf'##! ''\\') - df.append(r'##! ''\\') + df.append(r'##! ''\\') df.append(rf'##! ''\\') - df.append(r'##! ') + df.append(r'##! ') df.append(r'##!') if not df.contains(r'M_PAGE_FINE_PRINT'): df.append(r'##! M_PAGE_FINE_PRINT = ''\\') @@ -308,7 +308,7 @@ def _preprocess_doxyfile(context): df.append(r'##! Documentation created using ''\\') df.append(r'##! Doxygen ''\\') df.append(r'##! + mosra/m.css ''\\') - df.append(r'##! + marzer/dox') + df.append(r'##! + marzer/poxy') df.append(r'##!') # move to a temp file path @@ -323,7 +323,7 @@ def _preprocess_doxyfile(context): df.cleanup() if context.dry_run: context.info(r'#====================================================================================') - context.info(r'# dox-generated Doxyfile') + context.info(r'# poxy-generated Doxyfile') context.info(r'#====================================================================================') context.info(df.get_text()) context.info(r'#====================================================================================') @@ -904,7 +904,7 @@ def main(): type=Path, nargs='?', default=Path('.'), - help=r'a path to a Doxyfile, dox.toml, or a directory containing one/both (default: %(default)s/)' + help=r'a path to a Doxyfile, poxy.toml, or a directory containing one/both (default: %(default)s/)' ) args.add_argument( r'-v', r'--verbose', diff --git a/dox/soup.py b/poxy/soup.py similarity index 96% rename from dox/soup.py rename to poxy/soup.py index 2d17b09..cb801df 100644 --- a/dox/soup.py +++ b/poxy/soup.py @@ -1,11 +1,11 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT try: - from dox.utils import * + from poxy.utils import * except: from utils import * diff --git a/dox/utils.py b/poxy/utils.py similarity index 96% rename from dox/utils.py rename to poxy/utils.py index 861b8a6..9dad07f 100644 --- a/dox/utils.py +++ b/poxy/utils.py @@ -1,7 +1,7 @@ #!/usr/bin/env python3 -# This file is a part of marzer/dox and is subject to the the terms of the MIT license. +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. # Copyright (c) Mark Gillard -# See https://github.com/marzer/dox/blob/master/LICENSE for the full license text. +# See https://github.com/marzer/poxy/blob/master/LICENSE for the full license text. # SPDX-License-Identifier: MIT import sys diff --git a/setup.py b/setup.py new file mode 100644 index 0000000..b979c61 --- /dev/null +++ b/setup.py @@ -0,0 +1,98 @@ +#!/usr/bin/env python3 +# This file is a part of marzer/poxy and is subject to the the terms of the MIT license. +# Copyright (c) Mark Gillard +# See https://github.com/marzer/poxy/blob/master/LICENSE.txt for the full license text. +# SPDX-License-Identifier: MIT + +# set up based on this: https://thucnc.medium.com/how-to-publish-your-own-python-package-to-pypi-4318868210f9 +# windows: +# py setup.py sdist bdist_wheel && twine upload dist/* && rmdir /S /Q dist + +import sys +from setuptools import setup, find_packages +from pathlib import Path + +def enum_subdirs(root): + root = Path(root).resolve() + assert root.is_dir() + subdirs = [] + for p in root.iterdir(): + if p.is_dir(): + subdirs.append(p) + subdirs = subdirs + enum_subdirs(p) + return subdirs + +package_dir = str(Path(Path(__file__).parent, r'poxy').resolve()) +data_subdirs = enum_subdirs(Path(package_dir, r'data')) +data_subdirs = [str(d)[len(package_dir):].strip('\\/').replace('\\', '/') for d in data_subdirs] +for excl in (r'/doc/', r'/test/', r'/test_doxygen', r'/test_python', r'/pelican-theme', r'__pycache__'): + data_subdirs = [d for d in data_subdirs if d.find(excl) == -1] +data_subdirs = [rf'{d}/*' for d in data_subdirs] + +README = '' +if Path('README.md').exists(): + with open('README.md', encoding='utf-8') as file: + README = file.read() + +HISTORY = '' +if Path('HISTORY.md').exists(): + with open('HISTORY.md', encoding='utf-8') as file: + HISTORY = file.read() + +setup_args = dict( + name=r'poxy', + version=r'0.1.0', + description=r'Documentation generator for C++.', + long_description_content_type=r'text/markdown', + long_description=f'{README}\n\n{HISTORY}'.strip(), + license=r'MIT', + packages=find_packages(), + author=r'Mark Gillard', + author_email=r'mark.gillard@outlook.com.au', + keywords=[ + r'c++', + r'doxygen', + r'documentation' + ], + url=r'https://github.com/marzer/poxy', + download_url=r'https://pypi.org/project/poxy/', + classifiers=[ + r'Development Status :: 3 - Alpha', + r'License :: OSI Approved :: MIT License', + r'Programming Language :: C++', + r'Topic :: Documentation', + r'Topic :: Software Development :: Documentation', + r'Topic :: Utilities' + ], + project_urls={ + r'Source': r'https://github.com/marzer/poxy', + r'Tracker': r'https://github.com/marzer/poxy/issues' + }, + python_requires=r'>=3', + package_data={ + r'poxy' : [ r'data/*', *data_subdirs ] + }, + exclude_package_data={ + r'poxy': [ + r'.git*', + r'.istanbul.yaml', + r'*.rst', + r'*.pyc', + r'data/mcss/doc/*', + r'data/mcss/documentation/test/*', + r'data/mcss/documentation/test_doxygen/*', + r'data/mcss/documentation/test_python/*', + r'data/mcss/package/*', + ] + }, + entry_points = { + r'console_scripts' : [ r'poxy = poxy.__main__:main' ] + } +) + +install_requires = None +with open('requirements.txt', encoding='utf-8') as file: + install_requires = file.read().strip().split() + +if __name__ == '__main__': + setup(**setup_args, install_requires=install_requires)