Skip to content

Commit

Permalink
Point fixes for CleverDict 1.8.1 compatibility
Browse files Browse the repository at this point in the history
  • Loading branch information
Peter Fison committed Jan 30, 2021
1 parent 55e3be0 commit dddb19d
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
7 changes: 4 additions & 3 deletions easypypi/easypypi.py
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ def __str__(self):
output = self.info(as_str=True)
return output.replace("CleverDict", type(self).__name__, 1)

def save(self, key=None, value=None):
def save(self, name=None, value=None):
"""
This method is called by CleverDict whenever a value or attribute
changes. Used here to update the config file automatically.
Expand Down Expand Up @@ -96,8 +96,8 @@ def save(self, key=None, value=None):
if "password" not in x.lower()
}
json.dump(fields_dict, file, indent=4)
if key:
if "password" in key.lower():
if name:
if "password" in name.lower():
location = "memory but NOT saved to file"
else:
location = self.__class__.config_filepath
Expand Down Expand Up @@ -771,6 +771,7 @@ def create_essential_files(self):
sfp = self.setup_filepath.parent
# setup.py and LICENSE can be be overwritten as they're most likely to
# be changed by user after publishing, and no code changes will be lost:
print(self.license_text)
create_file(sfp / "LICENSE", self.license_text, overwrite=True)
create_file(self.setup_filepath, self.script_lines, overwrite=True)
# Other files are just bare-bones initially, imported from templates:
Expand Down
3 changes: 2 additions & 1 deletion easypypi/shared_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@ def create_file(filepath, content, **kwargs):
backup = filepath.with_name(f"{filepath.stem} - old.py")
filepath.replace(backup)
print(f"\n✓ Renamed {filepath.name} to:\n {backup.name}")
filepath.touch() # Create empty file to append lines to
else:
os.remove(filepath)
else:
print(f"\nⓘ Existing file preserved:\n {filepath}")
return "file exists"
Expand Down

0 comments on commit dddb19d

Please sign in to comment.