Skip to content

Commit

Permalink
Switched from using 'distutils' to 'setuptools' for installing AMBuild.
Browse files Browse the repository at this point in the history
Fixes alliedmodders#68: See [bpo-41282](https://bugs.python.org/issue41282) for switch reason.
  • Loading branch information
WildCard65 committed Jul 21, 2020
1 parent 1840f9c commit 373a1d9
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 75 deletions.
20 changes: 20 additions & 0 deletions ambuild2/run.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,3 +132,23 @@ def BuildParser(sourcePath, api, buildPath=None):

Preparer = PreparerForAPI(api)
return Preparer(sourcePath=sourcePath, buildPath=buildPath)


def cli_run():
options, argv = BuildOptions()

if not len(argv):
folder = '.'
else:
folder = argv[0]
if not os.path.exists(folder):
sys.stderr.write('Error: path does not exist: {0}\n'.format(folder))
sys.exit(1)

cache_path = os.path.join(folder, '.ambuild2', 'graph')
if not os.path.exists(cache_path):
sys.stderr.write('Error: folder was not configured for AMBuild.\n')
sys.exit(1)

if not Build(os.path.abspath(folder), options, argv):
sys.exit(1)
28 changes: 0 additions & 28 deletions scripts/ambuild

This file was deleted.

15 changes: 0 additions & 15 deletions scripts/ambuild.bat

This file was deleted.

48 changes: 16 additions & 32 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,23 +1,19 @@
#!/usr/bin/env python
# vim: set ts=2 sw=2 tw=99 et:
import sys
from distutils.core import setup
from setuptools import setup, find_packages

try:
import sqlite3
except:
raise Exception('py-sqlite3 must be installed')

scripts = [
'scripts/ambuild'
]

if sys.platform == 'win32':
scripts.append('scripts/ambuild.bat')
elif sys.platform == 'darwin':
scripts.append('scripts/ambuild_dsymutil_wrapper.sh')
else:
scripts.append('scripts/ambuild_objcopy_wrapper.sh')
raise SystemError('py-sqlite3 must be installed')

amb_scripts = []
if sys.platform != 'win32':
if sys.platform == 'darwin':
amb_scripts.append('scripts/ambuild_dsymutil_wrapper.sh')
else:
amb_scripts.append('scripts/ambuild_objcopy_wrapper.sh')

setup(
name = 'AMBuild',
Expand All @@ -26,23 +22,11 @@
author = 'David Anderson',
author_email = 'dvander@alliedmods.net',
url = 'http://www.alliedmods.net/ambuild',
packages = [
'ambuild',
'ambuild2',
'ambuild2.frontend',
'ambuild2.ipc',
'ambuild2.frontend.v2_0',
'ambuild2.frontend.v2_0.amb2',
'ambuild2.frontend.v2_0.base',
'ambuild2.frontend.v2_0.cpp',
'ambuild2.frontend.v2_0.vs',
'ambuild2.frontend.v2_1',
'ambuild2.frontend.v2_1.amb2',
'ambuild2.frontend.v2_1.base',
'ambuild2.frontend.v2_1.cpp',
'ambuild2.frontend.v2_1.vs',
'ambuild2.frontend.v2_1.tools',
],
scripts = scripts
packages = find_packages(),
entry_points = {
'console_scripts': [
'ambuild = ambuild2.run:cli_run'
]
},
scripts=amb_scripts
)

0 comments on commit 373a1d9

Please sign in to comment.