From eacdc99538ec528d4c945360b1abe195536ae711 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 31 Oct 2019 16:44:38 +0100 Subject: [PATCH 1/4] setup script now correctly builds a pip package --- .gitignore | 1 + novelWriter.py => novelWriter | 0 sample/sampleNovel/nwProject.nwx | 2 +- setup.py | 48 ++++++++++++++++++++++++++++---- 4 files changed, 45 insertions(+), 6 deletions(-) rename novelWriter.py => novelWriter (100%) diff --git a/.gitignore b/.gitignore index a2a18869..77308910 100644 --- a/.gitignore +++ b/.gitignore @@ -4,6 +4,7 @@ dist/ build/ deploy/ *.spec +*.egg-info # Documentation docs/build/ diff --git a/novelWriter.py b/novelWriter similarity index 100% rename from novelWriter.py rename to novelWriter diff --git a/sample/sampleNovel/nwProject.nwx b/sample/sampleNovel/nwProject.nwx index af138bec..847d7659 100644 --- a/sample/sampleNovel/nwProject.nwx +++ b/sample/sampleNovel/nwProject.nwx @@ -1,5 +1,5 @@ - + Sample Project Sample Project diff --git a/setup.py b/setup.py index 84b4d17f..66e3e2d1 100755 --- a/setup.py +++ b/setup.py @@ -1,7 +1,45 @@ #!/usr/bin/env python3 -from distutils.core import setup -setup( - name="novelwriter", - version="0.3.2", - py_modules=["nw"], +import setuptools + +with open("README.md", "r") as inFile: + long_description = inFile.read() + +setuptools.setup( + name = "novelWriter", + version = "0.3.2", + author = "Veronica Berglyd Olsen", + author_email = "code@vkbo.net", + description = "A markdown-like document editor for writing novels", + long_description = long_description, + long_description_content_type = "text/markdown", + license = "GNU General Public License v3", + url = "https://github.com/vkbo/novelWriter", + scripts = ["novelWriter"], + packages = setuptools.find_packages(exclude=["docs","tests","sample"]), + include_package_data = True, + package_data = {"": ["*.conf"]}, + project_urls = { + "Bug Tracker": "https://github.com/vkbo/novelWriter/issues", + "Documentation": "https://novelwriter.readthedocs.io/", + "Source Code": "https://github.com/vkbo/novelWriter", + }, + classifiers = [ + "Programming Language :: Python :: 3", + "License :: OSI Approved :: GNU General Public License v3 (GPLv3)", + "Development Status :: 3 - Alpha", + "Operating System :: OS Independent", + "Intended Audience :: End Users/Desktop", + "Natural Language :: English", + "Topic :: Text Editors", + ], + python_requires = ">=3.5", + install_requires = [ + "pyqt5", + "appdirs", + "lxml", + "pyenchant", + "pycountry", + "latexcodec", + "pypandoc", + ], ) From d447453b8a821b9c07a394d3c5069d3e0bae54e6 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 31 Oct 2019 16:45:18 +0100 Subject: [PATCH 2/4] =?UTF-8?q?Added=20a=20bunch=20of=20files=20needed=20f?= =?UTF-8?q?or=20setuptools=20to=20work=20correctly=C2=A3?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- MANIFEST.in | 3 +++ nw/convert/__init__.py | 0 nw/convert/file/__init__.py | 0 nw/convert/text/__init__.py | 0 nw/gui/__init__.py | 0 nw/gui/dialogs/__init__.py | 0 nw/gui/elements/__init__.py | 0 nw/gui/tools/__init__.py | 0 nw/project/__init__.py | 0 nw/tools/__init__.py | 0 setup.cfg | 5 +++++ 11 files changed, 8 insertions(+) create mode 100644 MANIFEST.in create mode 100644 nw/convert/__init__.py create mode 100644 nw/convert/file/__init__.py create mode 100644 nw/convert/text/__init__.py create mode 100644 nw/gui/__init__.py create mode 100644 nw/gui/dialogs/__init__.py create mode 100644 nw/gui/elements/__init__.py create mode 100644 nw/gui/tools/__init__.py create mode 100644 nw/project/__init__.py create mode 100644 nw/tools/__init__.py create mode 100644 setup.cfg diff --git a/MANIFEST.in b/MANIFEST.in new file mode 100644 index 00000000..224c33a5 --- /dev/null +++ b/MANIFEST.in @@ -0,0 +1,3 @@ +include LICENSE.md +include nw/graphics/* +recursive-include nw/themes * diff --git a/nw/convert/__init__.py b/nw/convert/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/convert/file/__init__.py b/nw/convert/file/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/convert/text/__init__.py b/nw/convert/text/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/gui/__init__.py b/nw/gui/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/gui/dialogs/__init__.py b/nw/gui/dialogs/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/gui/elements/__init__.py b/nw/gui/elements/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/gui/tools/__init__.py b/nw/gui/tools/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/project/__init__.py b/nw/project/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/nw/tools/__init__.py b/nw/tools/__init__.py new file mode 100644 index 00000000..e69de29b diff --git a/setup.cfg b/setup.cfg new file mode 100644 index 00000000..065ab174 --- /dev/null +++ b/setup.cfg @@ -0,0 +1,5 @@ +[metadata] +license_files = LICENSE.md + +[bdist_wheel] +universal = 0 From c92a0bb5e53ed9f9953656ea46a5c3876eec2578 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 31 Oct 2019 16:46:53 +0100 Subject: [PATCH 3/4] Make graphcis folder include also recursive --- MANIFEST.in | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/MANIFEST.in b/MANIFEST.in index 224c33a5..f38487d8 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -1,3 +1,3 @@ include LICENSE.md -include nw/graphics/* +recursive-include nw/graphics * recursive-include nw/themes * From 99c165801b25e25806fab86895cccf51df478281 Mon Sep 17 00:00:00 2001 From: "Veronica K. B. Olsen" <1619840+vkbo@users.noreply.github.com> Date: Thu, 31 Oct 2019 16:56:50 +0100 Subject: [PATCH 4/4] Let's keep the main launcher novelWriter.py and let setuptools handle the rest --- novelWriter => novelWriter.py | 0 nw/__init__.py | 5 ++++- setup.py | 2 +- 3 files changed, 5 insertions(+), 2 deletions(-) rename novelWriter => novelWriter.py (100%) diff --git a/novelWriter b/novelWriter.py similarity index 100% rename from novelWriter rename to novelWriter.py diff --git a/nw/__init__.py b/nw/__init__.py index 809aeb18..dd091a10 100644 --- a/nw/__init__.py +++ b/nw/__init__.py @@ -67,10 +67,13 @@ logger = logging.getLogger(__name__) # Load the main config as a global object CONFIG = Config() -def main(sysArgs): +def main(sysArgs=None): """Parses command line, sets up logging, and launches main GUI. """ + if sysArgs is None: + sysArgs = sys.argv[1:] + # Valid Input Options shortOpt = "hdDqtl:v" longOpt = [ diff --git a/setup.py b/setup.py index 66e3e2d1..9e24b86e 100755 --- a/setup.py +++ b/setup.py @@ -14,7 +14,7 @@ setuptools.setup( long_description_content_type = "text/markdown", license = "GNU General Public License v3", url = "https://github.com/vkbo/novelWriter", - scripts = ["novelWriter"], + entry_points={"console_scripts": ["novelWriter=nw:main"]}, packages = setuptools.find_packages(exclude=["docs","tests","sample"]), include_package_data = True, package_data = {"": ["*.conf"]},