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..a3b595a 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: + # 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 @@ -313,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" 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 2d8bf01..1eca6f0 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" @@ -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: ["*.*"]}, )