Commit 7132a52d authored by Craig Small's avatar Craig Small

more python support

parent 45162427
......@@ -21,6 +21,7 @@ dh-make (1.201602) UNRELEASED; urgency=medium
* watch.ex same for all classes
* Update watch example to version 4
* Dropped multi package class, use --docs to get docs package
* prompts to change info by user Closes: #298248
-- Craig Small <csmall@debian.org> Mon, 04 Jan 2016 19:27:21 +1100
......
......@@ -2,14 +2,14 @@ Source: dh-make
Section: devel
Priority: optional
Maintainer: Craig Small <csmall@debian.org>
Build-Depends: debhelper (>= 9)
Build-Depends: debhelper (>= 9), dh-python
Standards-Version: 3.9.6
Vcs-Git: git://anonscm.debian.org/collab-maint/dh-make.git
Vcs-Browser: https://anonscm.debian.org/cgit/collab-maint/dh-make.git
Package: dh-make
Architecture: all
Depends: debhelper (>= 9), make, ${perl:Depends}, dpkg-dev, ${misc:Depends}
Depends: debhelper (>= 9), make, ${python:Depends}, dpkg-dev, ${misc:Depends}
Suggests: build-essential
Description: tool that converts source archives into Debian package source
This package allows you to take a standard (or upstream) source package
......
#!/usr/bin/make -f
#
# Makefile for dh-make package
# see EXAMPLES in dpkg-buildflags(1) and read /usr/share/dpkg/*
DPKG_EXPORT_BUILDFLAGS = 1
include /usr/share/dpkg/default.mk
%:
dh $@
dh $@ --with dh_python3
#!/usr/bin/env python
#!/usr/bin/python3
import argparse
import sys
......@@ -95,7 +95,7 @@ def process_copyright(args, subs_func):
exit(1)
def process_docs(docs_package, package_name):
def process_docs(python, docs_package, package_name):
'''
Find all documents and put the into the debian/docs
or debian/package.docs file for dh_installdocs
......@@ -104,7 +104,9 @@ def process_docs(docs_package, package_name):
ignore_files = ('CMakeList.txt', 'CMakeLists.txt')
docfiles = []
if docs_package:
if python:
filename = 'python-{}-doc.docs'.format(package_name)
elif docs_package:
filename = '{}.docs'.format(package_name)
else:
filename = '{}-docs.docs'.format(package_name)
......@@ -138,14 +140,16 @@ Description: documentation for {0}
'''.format(package_name))
def process_infos(docs_package, package_name):
def process_infos(python, docs_package, package_name):
'''
Find all the info documents and put into debian/PACKAGE.info
or debian/PACKAGE-doc.info file for dh_installinfo
'''
infos = []
if docs_package:
if python:
filename = 'python-{}-doc.info'.format(package_name)
elif docs_package:
filename = '{}.info'.format(package_name)
else:
filename = '{}-docs.info'.format(package_name)
......@@ -195,9 +199,11 @@ def get_subs(args):
'YEAR': time.strftime('%Y'),
'USERNAME': get_username(),
'POLICY': policy_version,
'BUILD_DEPS': [],
'BUILD_DEPS': ['debhelper (>=9)'],
'DH_ADDON': '',
'SOURCE_EXTRADOCS': '',
'RULES_START_TEXT': '',
'RULES_END_TEXT': '',
}
return subs
......@@ -206,6 +212,7 @@ class PackageClass(Enum):
indep = 'i'
library = 'l'
single = 's'
python = 'p'
defaultless = 'defaultless'
@classmethod
......@@ -221,6 +228,8 @@ class PackageClass(Enum):
return cls.indep
elif args.library:
return cls.library
elif args.python:
return cls.python
elif args.single:
return cls.single
return None
......@@ -320,14 +329,16 @@ parser.add_argument('--with-emacs', action='store_true',
help='add files for emacsen')
pcgroup = parser.add_mutually_exclusive_group()
pcgroup.add_argument('-C', '--packageclass', metavar='<cls>',
choices=('s', 'i', 'l'),
help='set package class (s|i|l)')
choices=('s', 'i', 'l', 'p'),
help='set package class (s|i|l|p)')
pcgroup.add_argument('-s', '--single', action='store_true',
help='set package class to single')
pcgroup.add_argument('-i', '--indep', action='store_true',
help='set package class to arch-independent')
pcgroup.add_argument('-l', '--library', action='store_true',
help='set package class to library')
pcgroup.add_argument('--python', action='store_true',
help='set package class to python')
parser.add_argument('-v', '--version', action='version',
version=version_string)
......@@ -545,10 +556,10 @@ def choose_package_class(old_package_class):
the user to choose one
"""
valid = {'s': PackageClass.single, 'i': PackageClass.indep,
'l': PackageClass.library, }
'l': PackageClass.library, 'p': PackageClass.python}
while True:
print('Type of package: (single, indep, library)\n'
'[s/i/l/]?')
print('Type of package: (single, indep, library, python)\n'
'[s/i/l/p]?')
if old_package_class is not None:
print('Hit enter for default: {}'.
format(old_package_class.name))
......@@ -634,12 +645,27 @@ or add --createorig to create one.'''.
exit(1)
def get_build_deps(package_class):
def setup_python(subs):
'''
Determine the build dependencies
Setup a python package
'''
deps = ['debhelper (>=9)']
return deps
subs['RULES_START_TEXT'] = 'export PYBUILD_NAME={}\n'.format(
subs['PACKAGE'])
subs['RULES_END_TEXT'] = '''
# If you need to rebuild the Sphinx documentation
# Add spinxdoc to the dh --with line
#override_dh_auto_build:
#\tdh_auto_build
#\tPYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bhtml\
docs/ build/html # HTML generator
#\tPYTHONPATH=. http_proxy='127.0.0.1:9' sphinx-build -N -bman\
docs/ build/man # Manpage generator
'''
subs['DH_ADDON'] += ' --with python2,python3'\
'--buildsystem=pybuild'
subs['BUILD_DEPS'].extend(['dh-python', 'python-all (>= 2.6.6-3~)',
'python-setuptools', 'python3-all',
'python3-setuptools'])
def setup_autotools(subs):
......@@ -707,16 +733,35 @@ def do_debianize(args, subs):
check_origtar(args.file, args.createorig,
subs['PACKAGE'], subs['VERSION'])
subs['BUILD_DEPS'] = get_build_deps(args.package_class)
if os.path.isfile('./configure') and os.access('./configure', os.X_OK):
setup_autotools(subs)
elif os.path.isfile('CmakeLists.txt'):
setup_cmake(subs)
if args.python:
setup_python(subs)
else:
setup_make()
subs['RULES_START_TEXT'] = '''
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
'''
subs['RULES_END_TEXT'] = '''
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
'''
if os.path.isfile('./configure') and os.access('./configure', os.X_OK):
setup_autotools(subs)
elif os.path.isfile('CmakeLists.txt'):
setup_cmake(subs)
else:
setup_make()
# Creat debian directory
# Create debian directory
if args.addmissing is None:
if os.path.isdir('debian'):
print('You already have a debian/ subdirectory in the source'
......@@ -766,7 +811,7 @@ def do_debianize(args, subs):
exit(1)
process_dir(args, subs_func, args.templates)
process_docs(args.docs, subs['PACKAGE'])
process_docs(args.python, args.docs, subs['PACKAGE'])
process_infos(args.docs, subs['PACKAGE'])
rename_package_files(subs['PACKAGE'])
......
......@@ -3,20 +3,8 @@
# output every command that modifies files on the build system.
#export DH_VERBOSE = 1
# see FEATURE AREAS in dpkg-buildflags(1)
#export DEB_BUILD_MAINT_OPTIONS = hardening=+all
# see ENVIRONMENT in dpkg-buildflags(1)
# package maintainers to append CFLAGS
#export DEB_CFLAGS_MAINT_APPEND = -Wall -pedantic
# package maintainers to append LDFLAGS
#export DEB_LDFLAGS_MAINT_APPEND = -Wl,--as-needed
#RULES_START_TEXT#
%:
dh $@ #DH_ADDON#
# dh_make generated override targets
# This is example for Cmake (See https://bugs.debian.org/641051 )
#override_dh_auto_configure:
# dh_auto_configure -- \
# -DCMAKE_LIBRARY_PATH=$(DEB_HOST_MULTIARCH)
#RULES_END_TEXT#
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment