Skip to content

Commit

Permalink
Update setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
mtshiba committed Sep 17, 2023
1 parent bfdafa9 commit 9e3df04
Showing 1 changed file with 16 additions and 2 deletions.
18 changes: 16 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# To build the package, run `python -m build --wheel`.

from pathlib import Path
import os
import shlex
Expand All @@ -8,6 +10,18 @@
from setuptools_rust import RustBin
import tomli

def removeprefix(string, prefix):
if string.startswith(prefix):
return string[len(prefix):]
else:
return string

def removesuffix(string, suffix):
if string.endswith(suffix):
return string[:-len(suffix)]
else:
return string

class Clean(Command):
user_options = []
def initialize_options(self):
Expand All @@ -34,8 +48,8 @@ def run(self):

home = os.path.expanduser("~")
file_and_dirs = glob(home + "/" + ".erg/lib/**", recursive=True)
paths = [Path(home + "/" + path) for path in file_and_dirs if os.path.isfile(home + "/" + path)]
files = [(str(path).removesuffix("/" + path.name).removeprefix(home), str(path)) for path in paths]
paths = [Path(path) for path in file_and_dirs if os.path.isfile(path)]
files = [(removeprefix(removesuffix(str(path), "/" + path.name), home), str(path)) for path in paths]
data_files = {}
for key, value in files:
if key in data_files:
Expand Down

0 comments on commit 9e3df04

Please sign in to comment.