poikilos
2 years ago
27 changed files with 1532 additions and 1169 deletions
@ -0,0 +1,103 @@ |
|||||
|
#!/usr/bin/env python |
||||
|
''' |
||||
|
This module assists with building games from other games, mods, and |
||||
|
patches. |
||||
|
''' |
||||
|
from __future__ import print_function |
||||
|
|
||||
|
import sys |
||||
|
import platform |
||||
|
import os |
||||
|
|
||||
|
profile = None |
||||
|
if platform.system() == "Windows": |
||||
|
profile = os.environ.get('USERPROFILE') |
||||
|
else: |
||||
|
profile = os.environ.get('HOME') |
||||
|
|
||||
|
verbosity = 0 |
||||
|
max_verbosity = 2 |
||||
|
|
||||
|
|
||||
|
def echo0(*args, **kwargs): |
||||
|
print(*args, file=sys.stderr, **kwargs) |
||||
|
|
||||
|
|
||||
|
def echo1(*args, **kwargs): |
||||
|
if verbosity < 1: |
||||
|
return False |
||||
|
print(*args, file=sys.stderr, **kwargs) |
||||
|
return True |
||||
|
|
||||
|
|
||||
|
def echo2(*args, **kwargs): |
||||
|
if verbosity < 2: |
||||
|
return False |
||||
|
print(*args, file=sys.stderr, **kwargs) |
||||
|
return True |
||||
|
|
||||
|
|
||||
|
def get_verbosity(): |
||||
|
return verbosity |
||||
|
|
||||
|
|
||||
|
def set_verbosity(level): |
||||
|
if level is True: |
||||
|
verbosity = 1 |
||||
|
elif level is False: |
||||
|
verbosity = 0 |
||||
|
elif level in range(max_verbosity+1): |
||||
|
verbosity = level |
||||
|
raise ValueError( |
||||
|
"verbosity must be {} at maximum.".format(max_verbosity) |
||||
|
) |
||||
|
|
||||
|
|
||||
|
try: |
||||
|
import mtanalyze |
||||
|
except ModuleNotFoundError as ex: |
||||
|
# tryMTA = os.path.join(profile, "git", "mtanalyze") |
||||
|
moduleDir = os.path.dirname(os.path.realpath(__file__)) |
||||
|
REPO_DIR = os.path.dirname(moduleDir) |
||||
|
modulesDir = os.path.dirname(REPO_DIR) |
||||
|
echo0("* looking for mtanalyze in modulesDir \"{}\"" |
||||
|
"".format(modulesDir)) |
||||
|
tryMTA = os.path.abspath(os.path.join(modulesDir, "mtanalyze")) |
||||
|
if os.path.isdir(tryMTA): |
||||
|
sys.path.append(tryMTA) |
||||
|
import mtanalyze |
||||
|
# ^ import mtanalyze/mtanalyze purposely since the main |
||||
|
# mtanalyze/ directory is a setuptools package not a module. |
||||
|
else: |
||||
|
echo0("") |
||||
|
echo0("You must install mtanalyze alongside") |
||||
|
echo0("EnlivenMinetest such that ../mtanalize/mtanalize exists") |
||||
|
echo0("such as via:") |
||||
|
echo0(" git clone https://github.com/poikilos/mtanalyze {}" |
||||
|
"".format(tryMTA)) |
||||
|
echo0("") |
||||
|
# raise tryMTA |
||||
|
exit(1) |
||||
|
|
||||
|
# from mtanalyze import profile_path |
||||
|
MY_MODULE_DIR = os.path.dirname(os.path.realpath(__file__)) |
||||
|
# ^ realpath follows symlinks |
||||
|
REPO_DIR = os.path.dirname(MY_MODULE_DIR) |
||||
|
MODS_STOPGAP_DIR = os.path.join(REPO_DIR, "patches", "mods-stopgap") |
||||
|
if not os.path.isdir(MODS_STOPGAP_DIR): |
||||
|
echo0("Error: \"{}\" is missing.".format(MODS_STOPGAP_DIR)) |
||||
|
exit(1) |
||||
|
BASE_DIR = os.path.join(REPO_DIR, "Bucket_Game-base") |
||||
|
if not os.path.isdir(BASE_DIR): |
||||
|
echo0("Error: \"{}\" is missing.".format(BASE_DIR)) |
||||
|
exit(1) |
||||
|
BRANCHES_DIR = os.path.join(REPO_DIR, "Bucket_Game-branches") |
||||
|
if not os.path.isdir(BRANCHES_DIR): |
||||
|
echo0("Error: \"{}\" is missing.".format(BRANCHES_DIR)) |
||||
|
exit(1) |
||||
|
|
||||
|
# NOTE: get a git repo's origin via: git remote show origin |
||||
|
|
||||
|
|
||||
|
def getSGPath(stopgap_mod_name): |
||||
|
return os.path.join(MODS_STOPGAP_DIR, stopgap_mod_name) |
@ -0,0 +1,77 @@ |
|||||
|
#!/usr/bin/env python |
||||
|
import setuptools |
||||
|
import sys |
||||
|
import os |
||||
|
# - For the example on which this was based, see |
||||
|
# https://github.com/poikilos/linux-preinstall/blob/main/setup.py |
||||
|
# which is based on |
||||
|
# https://github.com/poikilos/world_clock/blob/main/setup.py |
||||
|
# which is based on |
||||
|
# https://github.com/poikilos/nopackage/blob/main/setup.py |
||||
|
# which is based on |
||||
|
# https://github.com/poikilos/pypicolcd/blob/master/setup.py |
||||
|
# - For nose, see https://github.com/poikilos/mgep/blob/master/setup.py |
||||
|
|
||||
|
# python_mr = sys.version_info.major |
||||
|
# versionedModule = {} |
||||
|
# versionedModule['urllib'] = 'urllib' |
||||
|
# if python_mr == 2: |
||||
|
# versionedModule['urllib'] = 'urllib2' |
||||
|
|
||||
|
install_requires = [] |
||||
|
|
||||
|
if os.path.isfile("requirements.txt"): |
||||
|
with open("requirements.txt", "r") as ins: |
||||
|
for rawL in ins: |
||||
|
line = rawL.strip() |
||||
|
if len(line) < 1: |
||||
|
continue |
||||
|
install_requires.append(line) |
||||
|
|
||||
|
description = '''Manage Minetest using Python.''' |
||||
|
long_description = description |
||||
|
if os.path.isfile("readme.md"): |
||||
|
with open("readme.md", "r") as fh: |
||||
|
long_description = fh.read() |
||||
|
|
||||
|
setuptools.setup( |
||||
|
name='pyenliven', |
||||
|
version='0.3.0', |
||||
|
description=description, |
||||
|
long_description=long_description, |
||||
|
long_description_content_type="text/markdown", |
||||
|
classifiers=[ |
||||
|
'Development Status :: 3 - Alpha', |
||||
|
'Programming Language :: Python :: 3', |
||||
|
('License :: OSI Approved ::' |
||||
|
' GNU General Public License v2 or later (GPLv2+)'), |
||||
|
'Operating System :: POSIX :: Linux', |
||||
|
'Topic :: Software Development :: Version Control', |
||||
|
], |
||||
|
keywords=('minetest repo management commit data analyzer' |
||||
|
' meld merge compare files diff'), |
||||
|
url="https://github.com/poikilos/EnlivenMinetest", |
||||
|
author="Jake Gustafson", |
||||
|
author_email='7557867+poikilos@users.noreply.github.com', |
||||
|
license='GPLv2.1', |
||||
|
# packages=setuptools.find_packages(), |
||||
|
packages=['pyenliven'], |
||||
|
# include_package_data=True, # look for MANIFEST.in |
||||
|
# scripts=['example'] , |
||||
|
# See <https://stackoverflow.com/questions/27784271/ |
||||
|
# how-can-i-use-setuptools-to-generate-a-console-scripts-entry- |
||||
|
# point-which-calls> |
||||
|
entry_points={ |
||||
|
'console_scripts': [ |
||||
|
'compatiblizemod=pyenliven.compatiblizemod:main', |
||||
|
], |
||||
|
}, |
||||
|
install_requires=install_requires, |
||||
|
# versionedModule['urllib'], |
||||
|
# ^ "ERROR: Could not find a version that satisfies the requirement |
||||
|
# urllib (from nopackage) (from versions: none) |
||||
|
# ERROR: No matching distribution found for urllib" |
||||
|
test_suite='nose.collector', |
||||
|
tests_require=['nose', 'nose-cover3'], |
||||
|
zip_safe=False, # It can't run zipped due to needing data files. |
||||
|
) |
Loading…
Reference in new issue