Skip to content
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
21 changes: 21 additions & 0 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -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.
27 changes: 17 additions & 10 deletions easypypi/easypypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -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}",
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
Expand Down
2 changes: 1 addition & 1 deletion easypypi/setup_template.py
Original file line number Diff line number Diff line change
Expand Up @@ -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: ["*.*"]},
)
4 changes: 2 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down Expand Up @@ -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: ["*.*"]},
)