Skip to content

Commit

Permalink
Revised setup.py, enforcing prerequisite installation order. Updated …
Browse files Browse the repository at this point in the history
…(development) bash install wrappers over setup script.
  • Loading branch information
BuvinJ committed Jan 19, 2019
1 parent aa07205 commit e6f1bc3
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 12 deletions.
25 changes: 22 additions & 3 deletions install.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
thisScriptPath=`realpath $0`
thisDirPath=`dirname ${thisScriptPath}`
case "$(uname -s)" in
Linux*) context=Linux;;
Darwin*) context=Mac;;
CYGWIN*) context=Cygwin;;
MINGW*) context=MinGw;;
*) context=UNKNOWN;;
esac

if [ "${context}" == "Linux" ]; then
thisScriptPath=`realpath $0`
thisDirPath=`dirname ${thisScriptPath}`
py2=python
elif [ "${context}" == "Mac" ]; then
thisDirPath=$(cd "$(dirname "$0")"; pwd)
# using HomeBrew install of Py2, rather than stock...
py2=python2
else
# this will work as well as not having any of this...
thisDirPath=.
py2=python
fi
cd "${thisDirPath}"

python -m pip install .
${py2} -m pip install .
echo Press enter to continue; read dummy;
19 changes: 17 additions & 2 deletions install3.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
thisScriptPath=`realpath $0`
thisDirPath=`dirname ${thisScriptPath}`
case "$(uname -s)" in
Linux*) context=Linux;;
Darwin*) context=Mac;;
CYGWIN*) context=Cygwin;;
MINGW*) context=MinGw;;
*) context=UNKNOWN;;
esac

if [ "${context}" == "Linux" ]; then
thisScriptPath=`realpath $0`
thisDirPath=`dirname ${thisScriptPath}`
elif [ "${context}" == "Mac" ]; then
thisDirPath=$(cd "$(dirname "$0")"; pwd)
else
# this will work as well as not having any of this...
thisDirPath=.
fi
cd "${thisDirPath}"

python3 -m pip install .
Expand Down
54 changes: 47 additions & 7 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,49 @@
from setuptools import setup
exec(open('distbuilder/_version.py').read()) # defines __version__

# Override standard setutools commands.
# Enforce the order of dependency installation
#-------------------------------------------------
PREREQS = [ "six" ]

from setuptools.command.install import install
from setuptools.command.develop import develop
from setuptools.command.egg_info import egg_info

def requires( packages ):
from os import system
from sys import executable as PYTHON_PATH
from pkg_resources import require
require( "pip" )
CMD_TMPLT = '"' + PYTHON_PATH + '" -m pip install %s'
for pkg in packages: system( CMD_TMPLT % (pkg,) )

class OrderedInstall( install ):
def run( self ):
requires( PREREQS )
install.run( self )

class OrderedDevelop( develop ):
def run( self ):
requires( PREREQS )
develop.run( self )

class OrderedEggInfo( egg_info ):
def run( self ):
requires( PREREQS )
egg_info.run( self )

CMD_CLASSES = {
"install" : OrderedInstall
, "develop" : OrderedDevelop
, "egg_info": OrderedEggInfo
}
#-------------------------------------------------

# get __version__ and readme
exec( open('distbuilder/_version.py').read() )
with open( "README.md", "r" ) as f: readme = f.read()

setup (
setup (
name = "distbuilder",
version = __version__, # @UndefinedVariable
author = "BuvinJ",
Expand All @@ -19,7 +59,7 @@
],
url = "https://github.com/BuvinJT/distbuilder",
classifiers=[
'Programming Language :: Python :: 2.7',
"Programming Language :: Python :: 2.7",
"Programming Language :: Python :: 3",
"Operating System :: OS Independent",
"License :: OSI Approved :: GNU General Public License v3 (GPLv3)",
Expand All @@ -29,10 +69,10 @@
"Development Status :: 3 - Alpha"
],
packages = ["distbuilder"],
install_requires = [
"six"
, "PyInstaller" # Tested on PyInstaller v3.4
install_requires = [
"PyInstaller" # Tested on PyInstaller v3.4
, "opy_distbuilder"
],
include_package_data=True # extra files defined in MANIFEST.in
include_package_data=True, # extra files defined in MANIFEST.in
cmdclass = CMD_CLASSES
)

0 comments on commit e6f1bc3

Please sign in to comment.