fix setup.py errors so install and sdist work correctly

* LIBDEST and LIBPYTHON variables seem to exist on different platforms. Check both?
* Fix error in version number making of setup.py (%d when value is string), but superceeded by next change.
* Change version to single string following PEP-0440
* Bump micro version for new packaging. Would be 1.9c, but now 1.9.3.
* Move version info into a __version_info__.py file so it can be imported independently of gerbmerge.gerbmerge. This allows dependency resolution.
* Add requirement for simpleparse so it is installed automatically.
* Add a __main__ for use with `python -m`. This makes it easy to use from a pip installation.
This commit is contained in:
Ian Hartwig 2016-01-01 16:54:25 +00:00
parent c26f03a277
commit 753203172f
7 changed files with 36 additions and 13 deletions

8
.gitignore vendored
View File

@ -1,2 +1,8 @@
# distutils build output
*.pyc
/nbproject/private/
build/
dist/
gerbmerge-*.*/
MANIFEST
/nbproject/private/

0
COPYING Normal file
View File

View File

@ -1 +1,4 @@
# Placeholder for GerbMerge package
# make version info available at top level
from __version_info__ import __version__

5
gerbmerge/__main__.py Normal file
View File

@ -0,0 +1,5 @@
import gerbmerge
# Hook to call the self standing program when used with `python -m gerbmerge`
if __name__ == "__main__":
gerbmerge.main()

View File

@ -0,0 +1 @@
__version__ = "1.9.3"

View File

@ -43,8 +43,8 @@ import util
import scoring
import drillcluster
VERSION_MAJOR=1
VERSION_MINOR='9b'
# make version info available when running as script
from __version_info__ import __version__
RANDOM_SEARCH = 1
EXHAUSTIVE_SEARCH = 2
@ -804,7 +804,7 @@ def updateGUI(text = None):
if GUI != None:
GUI.updateProgress(text)
if __name__=="__main__":
def main():
try:
opts, args = getopt.getopt(sys.argv[1:], 'hvs', ['help', 'version', 'octagons=', 'random-search', 'full-search', 'rs-fsjobs=', 'search-timeout=', 'place-file=', 'no-trim-gerber', 'no-trim-excellon', 'skipdisclaimer'])
except getopt.GetoptError:
@ -815,13 +815,13 @@ if __name__=="__main__":
usage()
elif opt in ('-v', '--version'):
print """
GerbMerge Version %d.%s -- Combine multiple Gerber/Excellon files
GerbMerge Version %s -- Combine multiple Gerber/Excellon files
This program is licensed under the GNU General Public License (GPL)
Version 3. See LICENSE file or http://www.fsf.org for details of this license.
ProvideYourOwn - http://provideyourown.com
""" % (VERSION_MAJOR, VERSION_MINOR)
""" % (__version__)
sys.exit(0)
elif opt in ('--octagons', '--random-search','--full-search','--rs-fsjobs','--place-file','--no-trim-gerber','--no-trim-excellon', '--search-timeout', '-s', '--skipdisclaimer'):
pass ## arguments are valid
@ -832,4 +832,8 @@ ProvideYourOwn - http://provideyourown.com
usage()
sys.exit(merge(opts, args)) ## run germberge
if __name__=="__main__":
main()
# vim: expandtab ts=2 sw=2 ai syntax=python

View File

@ -6,7 +6,7 @@ import os
from distutils.core import setup, Extension
import distutils.sysconfig
from gerbmerge.gerbmerge import VERSION_MAJOR, VERSION_MINOR
from gerbmerge.__version_info__ import __version__
if sys.version_info < (2,4,0):
print '*'*73
@ -37,7 +37,10 @@ if sys.platform == 'win32' or ('bdist_wininst' in sys.argv):
BinFiles = ['misc/gerbmerge.bat']
BinDir = '.'
else:
DestLib = distutils.sysconfig.get_config_var('LIBPYTHON')
# try to find the library location on this platform
DestLib = None
if DestLib == None: DestLib = distutils.sysconfig.get_config_var('LIBPYTHON')
if DestLib == None: DestLib = distutils.sysconfig.get_config_var('LIBDEST')
DestDir = os.path.join(DestLib, 'gerbmerge')
BinFiles = ['misc/gerbmerge']
BinDir = distutils.sysconfig.get_config_var('BINDIR')
@ -52,7 +55,7 @@ python %s/site-packages/gerbmerge/gerbmerge.py $*
dist=setup (name = "gerbmerge",
license = "GPL",
version = "%d.%d" % (VERSION_MAJOR, VERSION_MINOR),
version = __version__,
long_description=\
r"""GerbMerge is a program that combines several Gerber
(i.e., RS274-X) and Excellon files into a single set
@ -69,15 +72,16 @@ For more details on installation or running GerbMerge, see the
URL below.
""",
description = "Merge multiple Gerber/Excellon files",
author = "Rugged Circuits LLC",
author_email = "support@ruggedcircuits.com",
url = "http://ruggedcircuits.com/gerbmerge",
author = "ProvideYourOwn.com",
author_email = "",
url = "https://github.com/provideyourown/gerbmerge",
packages = ['gerbmerge'],
platforms = ['all'],
data_files = [ (DestDir, AuxFiles),
(os.path.join(DestDir,'testdata'), SampleFiles),
(os.path.join(DestDir,'doc'), DocFiles),
(BinDir, BinFiles) ]
(BinDir, BinFiles) ],
install_requires = ['simpleparse']
)
do_fix_perms = 0