From 0f3de93425f63784a55d9ebdec80c8aaa6717c7e Mon Sep 17 00:00:00 2001 From: Peter Fison Date: Wed, 6 Jan 2021 12:50:49 +0000 Subject: [PATCH 1/4] Improved name initialisation --- LICENSE | 21 +++++++++++++++++++++ easypypi/easypypi.py | 17 +++++++++++------ setup.py | 2 +- 3 files changed, 33 insertions(+), 7 deletions(-) diff --git a/LICENSE b/LICENSE index f9bf359..ae88cbf 100644 --- a/LICENSE +++ b/LICENSE @@ -397,3 +397,24 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. +MIT License + +Copyright (c) 2021 Peter Fison + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/easypypi/easypypi.py b/easypypi/easypypi.py index a7ce459..28986fc 100644 --- a/easypypi/easypypi.py +++ b/easypypi/easypypi.py @@ -50,12 +50,6 @@ def __init__(self, name=None, **kwargs): super().__init__(**kwargs) if name: self.name = name - else: - self.name = sg.popup_get_text( - "Please enter a name for this package (all lowercase, underscores if needed):", - default_text=self.get("name") or "as_easy_as_pie", - **SG_KWARGS, - ) self.load_defaults() print( f"\n ⓘ easyPyPI template files are located in:\n {self.__class__.easypypi_dirpath}", @@ -116,8 +110,19 @@ def load_defaults(self): Entry point for loading default Package values as attributes. Choose between last updated JSON config file, and setup.py if it exists. """ + name = self.get('name') self.create_skeleton_config_file() self.load_defaults_from_config_file() + if not name: + # i.e. no name previously saved in config.json and none supplied + self.name = sg.popup_get_text( + "Please enter a name for this package (all lowercase, underscores if needed):", + default_text=self.get("name") or "as_easy_as_pie", + **SG_KWARGS, + ) + elif name:pythonfrom easypypi.easypypi import *package=Package() + # i.e. name supplied -> use instead of previously saved name + self.name = name self.create_folder_structure() if self.setup_filepath.is_file() and self.setup_filepath.stat().st_size: # If setup.py exists & isn't empty, overwrite default values diff --git a/setup.py b/setup.py index 2d8bf01..2ff199d 100644 --- a/setup.py +++ b/setup.py @@ -8,7 +8,7 @@ HERE = Path(__file__).parent NAME = "easypypi" GITHUB_USERNAME = "Pfython" -VERSION = "2.0.4a11" +VERSION = "2.0.4" DESCRIPTION = "By FAR the easiest and quickest way to publish your Python creations on PyPI so other people can just `pip install your_script`." LICENSE = "MIT License" AUTHOR = "Peter Fison" From 441eec14b05230a387de077884151ab01134e685 Mon Sep 17 00:00:00 2001 From: Peter Fison Date: Wed, 6 Jan 2021 12:51:21 +0000 Subject: [PATCH 2/4] Typos --- easypypi/easypypi.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/easypypi/easypypi.py b/easypypi/easypypi.py index 28986fc..dcfcdbd 100644 --- a/easypypi/easypypi.py +++ b/easypypi/easypypi.py @@ -120,7 +120,7 @@ def load_defaults(self): default_text=self.get("name") or "as_easy_as_pie", **SG_KWARGS, ) - elif name:pythonfrom easypypi.easypypi import *package=Package() + elif name: # i.e. name supplied -> use instead of previously saved name self.name = name self.create_folder_structure() From b4ecd655eabdc3a68da3996e939beab72a5ee8ba Mon Sep 17 00:00:00 2001 From: Peter Fison Date: Wed, 6 Jan 2021 13:06:02 +0000 Subject: [PATCH 3/4] Improved setup_filepath_str initialisation --- easypypi/easypypi.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/easypypi/easypypi.py b/easypypi/easypypi.py index dcfcdbd..a3b595a 100644 --- a/easypypi/easypypi.py +++ b/easypypi/easypypi.py @@ -318,11 +318,13 @@ def setup_filepath(self): return Path(self.setup_filepath_str) def get_default_filepath(self): - path = Path(self.get("setup_filepath_str") or Path().cwd()) # Default path should be the parent of self.name and not include it - while path.parts[-1] in [self.name, "setup.py"]: - path = Path().joinpath(*path.parts[:-1]) - return str(path) + path = self.get("setup_filepath_str") + if path: + return str(Path(self.get("setup_filepath_str")).parent.parent) + else: + return os.getcwd() + def get_default_version(self): return "0.0.1a1" From f8e1c38f1f02bfd62824ff1e9fbf0f02bda8ee74 Mon Sep 17 00:00:00 2001 From: Peter Fison Date: Wed, 6 Jan 2021 17:23:06 +0000 Subject: [PATCH 4/4] package_data= works for multiple modules --- easypypi/setup_template.py | 2 +- setup.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/easypypi/setup_template.py b/easypypi/setup_template.py index db2d873..8699192 100644 --- a/easypypi/setup_template.py +++ b/easypypi/setup_template.py @@ -44,5 +44,5 @@ def comma_split(text: str): keywords=comma_split(KEYWORDS), install_requires=comma_split(REQUIREMENTS), classifiers=comma_split(CLASSIFIERS), - package_data={"": ["README.md", "*.png", "*.ico"], NAME: ["*.*"]}, + package_data={"": ["*.md", "*.json", "*.png", "*.ico"], NAME: ["*.*"]}, ) diff --git a/setup.py b/setup.py index 2ff199d..1eca6f0 100644 --- a/setup.py +++ b/setup.py @@ -45,5 +45,5 @@ def comma_split(text: str): keywords=comma_split(KEYWORDS), install_requires=comma_split(REQUIREMENTS), classifiers=comma_split(CLASSIFIERS), - package_data={"": ["README.md", "*.png", "*.ico"], NAME: ["*.*"]}, + package_data={"": ["*.md", "*.json", "*.png", "*.ico"], NAME: ["*.*"]}, )