Skip to content

Commit

Permalink
simplify setup.py
Browse files Browse the repository at this point in the history
  • Loading branch information
laszewsk committed Dec 16, 2023
1 parent bc5f81b commit 27b4305
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 47 deletions.
1 change: 1 addition & 0 deletions cloudmesh/common/__init__.py
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
__version__ = '5.0.2'
43 changes: 19 additions & 24 deletions cloudmesh/common/util.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,18 +15,12 @@
from contextlib import contextmanager
from getpass import getpass
from pathlib import Path

import psutil
import pyfiglet
import requests

from cloudmesh.common.console import Console

try:
collectionsAbc = collections.abc
except AttributeError:
collectionsAbc = collections

from collections.abc import Mapping, Iterable

@contextmanager
def tempdir(*args, **kwargs):
Expand Down Expand Up @@ -197,8 +191,11 @@ def is_powershell():
# cmd.exe for CMD
# powershell.exe for powershell
# bash.exe for git bash
return (psutil.Process(os.getppid()).name() == "powershell.exe")

if platform.system() == "Windows":
import psutil
return (psutil.Process(os.getppid()).name() == "powershell.exe")
else:
return False

def is_cmd_exe():
"""
Expand Down Expand Up @@ -235,21 +232,19 @@ def path_expand(text, slashreplace=True):


def convert_from_unicode(data):
"""
converts unicode data to a string
:param data: the data to convert
:return:
"""
# if isinstance(data, basestring):

if isinstance(data, str):
return str(data)
elif isinstance(data, collectionsAbc.Mapping):
return dict(map(convert_from_unicode, data.items()))
elif isinstance(data, collectionsAbc.Iterable):
return type(data)(map(convert_from_unicode, data))
else:
return data
"""
Converts unicode data to a string
:param data: the data to convert
:return: converted data
"""
if isinstance(data, str):
return str(data)
elif isinstance(data, Mapping):
return dict(map(convert_from_unicode, data.items()))
elif isinstance(data, Iterable):
return type(data)(map(convert_from_unicode, data))
else:
return data


def yn_choice(message, default='y', tries=None):
Expand Down
8 changes: 1 addition & 7 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,10 +1,3 @@
#
# This file is autogenerated by pip-compile
# To update, run:
#
# pip-compile setup.py
#
psutil
python-dateutil
colorama
humanize
Expand All @@ -17,5 +10,6 @@ six
tabulate
tqdm
pyyaml
psutil
pywin32; platform_system == "Windows"
pyuac; platform_system == "Windows"
17 changes: 1 addition & 16 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,6 @@

from setuptools import find_packages, find_namespace_packages, setup

def check_python():
if not sys.version_info.major == 3 and \
sys.version_info.minor >= 7:
print("Python 3.7 or higher is required.")

print("You are using Python {}.{}."
.format(sys.version_info.major,
sys.version_info.minor))

sys.exit(1)

check_python()

def readfile(filename):
with io.open(filename, encoding="utf-8") as stream:
return stream.read()
Expand Down Expand Up @@ -107,9 +94,7 @@ def readfile(filename):
"Operating System :: Microsoft :: Windows :: Windows 10",
"Programming Language :: Python",
"Programming Language :: Python :: 3",
"Programming Language :: Python :: 3.7",
"Programming Language :: Python :: 3.8",
"Programming Language :: Python :: 3.9",
"Programming Language :: Python :: 3.12",
"Topic :: Internet",
"Topic :: Scientific/Engineering",
"Topic :: Software Development :: Libraries",
Expand Down

0 comments on commit 27b4305

Please sign in to comment.