Skip to content

Commit

Permalink
Use setup.py build -auto instead of config.py -auto.
Browse files Browse the repository at this point in the history
  • Loading branch information
illume committed Aug 3, 2018
1 parent 2db50d3 commit 60528cf
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 12 deletions.
3 changes: 1 addition & 2 deletions .appveyor.yml
Expand Up @@ -73,8 +73,7 @@ install:
- "set PATH=%PATH%;%APPVEYOR_BUILD_FOLDER%\\%PYPY_VERSION%"
- "%PYTHON% -m ensurepip"
- "%PYTHON% -m pip install -U wheel pip"
- "%WITH_COMPILER% %PYTHON% buildconfig\\config.py -auto"
- "%WITH_COMPILER% %PYTHON% setup.py build"
- "%WITH_COMPILER% %PYTHON% setup.py build -auto"
- "%WITH_COMPILER% %PYTHON% setup.py -setuptools %DISTRIBUTIONS%"
- ps: "ls dist"

Expand Down
3 changes: 1 addition & 2 deletions .travis.yml
Expand Up @@ -90,8 +90,7 @@ install:
- "$PIP_CMD install --upgrade pip"
- "$PIP_CMD install --upgrade numpy"
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then $PIP_CMD install delocate twine; fi
- "$PYTHON_EXE buildconfig/config.py -auto"
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then $PYTHON_EXE setup.py install -noheaders; fi
- if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then $PYTHON_EXE setup.py install -noheaders -auto; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then source buildconfig/ci/travis/.travis_osx_install.sh; fi
env:
global:
Expand Down
2 changes: 1 addition & 1 deletion buildconfig/ci/travis/.travis_osx_install.sh
Expand Up @@ -13,4 +13,4 @@ mv Setup.new Setup


# Makes for i386 and x86_64. With older 'core2' cpus.
HOMEBREW_BUILD_BOTTLE=1 HOMEBREW_BOTTLE_ARCH=core2 CXXFLAGS="-arch i386 -arch x86_64 -march=core2" CFLAGS="-arch i386 -arch x86_64 -march=core2" LDFLAGS="-arch i386 -arch x86_64" $PYTHON_EXE setup.py install -noheaders
HOMEBREW_BUILD_BOTTLE=1 HOMEBREW_BOTTLE_ARCH=core2 CXXFLAGS="-arch i386 -arch x86_64 -march=core2" CFLAGS="-arch i386 -arch x86_64 -march=core2" LDFLAGS="-arch i386 -arch x86_64" $PYTHON_EXE setup.py install -noheaders -auto
8 changes: 3 additions & 5 deletions buildconfig/config.py
Expand Up @@ -138,7 +138,7 @@ def writesetupfile(deps, basepath, additional_lines, sdl2=False):
if useit:
newsetup.write(line)

def main():
def main(auto=False):
additional_platform_setup = []
sdl2 = "-sdl2" in sys.argv
kwds = {}
Expand All @@ -162,9 +162,9 @@ def main():
additional_platform_setup = open(os.path.join(BASE_PATH, 'buildconfig', "Setup_Unix.in"), "r").readlines()

if os.path.isfile('Setup'):
if "-auto" in sys.argv or confirm('Backup existing "Setup" file', False):
if auto or confirm('Backup existing "Setup" file', False):
shutil.copyfile(os.path.join(BASE_PATH, 'Setup'), os.path.join(BASE_PATH, 'Setup.bak'))
if not "-auto" in sys.argv and os.path.isdir(os.path.join(BASE_PATH, 'build')):
if not auto and os.path.isdir(os.path.join(BASE_PATH, 'build')):
if confirm('Remove old build directory (force recompile)', False):
shutil.rmtree(os.path.join(BASE_PATH, 'build'), 0)

Expand All @@ -179,5 +179,3 @@ def main():
else:
print_("""\nThere was an error creating the Setup file, check for errors
or make a copy of "Setup.in" and edit by hand.""")

if __name__ == '__main__': main()
10 changes: 8 additions & 2 deletions setup.py
Expand Up @@ -87,6 +87,12 @@ def compilation_help():
"-Wnested-externs -Wshadow -Wredundant-decls"
sys.argv.remove ("-warnings")

AUTO_CONFIG = False
if '-auto' in sys.argv:
AUTO_CONFIG = True
sys.argv.remove('-auto')


import os.path, glob, stat, shutil
import distutils.sysconfig
from distutils.core import setup, Extension, Command
Expand Down Expand Up @@ -171,9 +177,9 @@ def do_directory(root_dest_path, root_src_path, elements):

#make sure there is a Setup file
if not os.path.isfile('Setup'):
print ('\n\nWARNING, No "Setup" File Exists, Running "config.py"')
print ('\n\nWARNING, No "Setup" File Exists, Running "buildconifg/config.py"')
import buildconfig.config
buildconfig.config.main()
buildconfig.config.main(AUTO_CONFIG)
print ('\nContinuing With "setup.py"')


Expand Down

0 comments on commit 60528cf

Please sign in to comment.