[sunzi/development] setup: Python exec. from env, catch up with changes
by Jan Pokorný
commit 0f5ce8775ec0b4c48b4a2e33ca5ab776e4c22f7a
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Sat Feb 25 15:16:54 2012 +0100
setup: Python exec. from env, catch up with changes
+ adjust comments
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
setup | 27 +++++++++++++++++++++------
1 files changed, 21 insertions(+), 6 deletions(-)
---
diff --git a/setup b/setup
index 6613e8c..ec08964 100755
--- a/setup
+++ b/setup
@@ -1,10 +1,25 @@
#!/bin/sh
-# refresh files from the newest archive if any present
+# vim: noet:ts=8:sw=8
+# Copyright 2012 Red Hat, Inc.
+# Part of sunzi project
+# Licensed under GPLv2 (a copy included / http://gnu.org/licenses/gpl-2.0.txt)
+# NOTE: not ready for arbitrary CWD, from . only
+
+# use specific Python executable if defined by the environment
+if [ -z "$PYTHON" ]; then
+ PYTHON=python
+fi
+
ARCHIVE=$(ls -1v *.tar.gz 2>/dev/null | head -n1)
if [ -n "$ARCHIVE" ] ; then
- tar xf "$ARCHIVE" --strip-components=1 --wildcards '*/setup*' '*/metadata.py' '*/dist-files/*'
-elif [ ! -f setup.cfg ]; then
- # or at least, start with pristine setup.cfg if missing
- cp dist-files/setup.cfg . 2>/dev/null
+ # refresh files from the newest archive if any present
+ EXTRACT='*/setup* */prepare-{common,dist}.py */metadata.py'
+ tar xf "$ARCHIVE" --strip-components=1 --wildcards "$EXTRACT"
+else
+ # or at least, start with pristine setup.cfg if missing
+ # hint: you can always run python setup.py directly
+ cp dist-files/setup.cfg . 2>/dev/null
+ # alternatively: $PYTHON setup.py prepare --gen defaultcfg
fi
-[ $# -eq 0 ] || python setup.py "$@"
+
+[ $# -eq 0 ] || "$PYTHON" setup.py "$@"
12 years, 1 month
[sunzi/development] dist-files/{CHANGES, PATCHES}.dist: adjust comments
by Jan Pokorný
commit dd7338fc136f1845e0f0a7aec3b7bd13ef7c79d9
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Sat Feb 25 15:15:05 2012 +0100
dist-files/{CHANGES,PATCHES}.dist: adjust comments
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
dist-files/CHANGES.dist | 6 +++---
dist-files/PATCHES.dist | 10 ++++------
2 files changed, 7 insertions(+), 9 deletions(-)
---
diff --git a/dist-files/CHANGES.dist b/dist-files/CHANGES.dist
index 3017fd4..3a5c5bf 100644
--- a/dist-files/CHANGES.dist
+++ b/dist-files/CHANGES.dist
@@ -1,8 +1,8 @@
# Part of sunzi project
-# Example of dist-specific 'CHANGES.<dist>' changelog
+# Example of distro-specific changelog
#
-# Place this file in the package's root, suffixed according
-# to the target distribution.
+# To be placed in the package's root and suffix changed according to
+# the target distribution.
* Mon Jan 01 2012 John Doe <john(a)example.com> - 0.1.0-1
- New upstream release 0.1.0.
diff --git a/dist-files/PATCHES.dist b/dist-files/PATCHES.dist
index 8b2a809..b55f900 100644
--- a/dist-files/PATCHES.dist
+++ b/dist-files/PATCHES.dist
@@ -1,10 +1,8 @@
# Part of sunzi project
-# Example of patch enumeration for RPM package
+# Example of distro-specific patch enumeration (for package recipe generator)
#
-# Place this file in the package's root, suffixed according
-# to the target distribution. Respective patch application
-# directives are generated automatically.
+# To be placed in the package's root and suffix changed according to
+# the target distribution.
#
-# NOTE: Make sure all the patches are applicable with '-p1'
-
+# Details depends on distro package recipe generator (see prepare-dist.py).
Patch1: foo.patch
12 years, 1 month
[sunzi/development] third-party/init.sh: formatting, comment
by Jan Pokorný
commit c05c6f0a09418b6caf6e42f4911aea695a5c347f
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Sat Feb 25 15:13:05 2012 +0100
third-party/init.sh: formatting, comment
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
third-party/init.sh | 9 +++++----
1 files changed, 5 insertions(+), 4 deletions(-)
---
diff --git a/third-party/init.sh b/third-party/init.sh
index 094ca2d..08d2203 100755
--- a/third-party/init.sh
+++ b/third-party/init.sh
@@ -1,6 +1,7 @@
#!/bin/sh
-# vim:set noet ts=4 sts=4:
+# vim: noet:ts=8:sw=8
# jpokorny(a)redhat.com
+# NOTE: not ready for arbitrary CWD, from . only
#
# internals
@@ -24,7 +25,7 @@ check_nargs () {
check_ret () {
[ $1 -ne 0 -a $1 -ne $RET_DEL ] \
- && do_announce "action failed with exit status $1" $CLR_BAD
+ && do_announce "action failed with exit status $1" $CLR_BAD
return $1
}
@@ -74,8 +75,8 @@ require () {
$tester $1 >/dev/null
ret=$?
[ $ret -eq 0 ] \
- && do_announce "require $1: checked ok" $CLR_OK \
- || do_announce "require $1: not met" $CLR_BAD
+ && do_announce "require $1: checked ok" $CLR_OK \
+ || do_announce "require $1: not met" $CLR_BAD
return $ret
}
12 years, 1 month
[sunzi/development] dist-specific part of prepare-devel.py into prepare-dist.py
by Jan Pokorný
commit c5f4afaa36a2e7b0cfe0fe616910c60fa4c018ec
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Sat Feb 25 15:10:53 2012 +0100
dist-specific part of prepare-devel.py into prepare-dist.py
For finer granularity
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
prepare-devel.py | 60 ----------------------------------------------
prepare-dist.py | 69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++
2 files changed, 69 insertions(+), 60 deletions(-)
---
diff --git a/prepare-devel.py b/prepare-devel.py
index d7b9150..c3d0627 100644
--- a/prepare-devel.py
+++ b/prepare-devel.py
@@ -10,7 +10,6 @@ from os import walk, makedirs
from os.path import join, exists, isfile, basename, splitext, normpath, sep
from shutil import copy2
from fnmatch import fnmatch
-import re
#
# JavaScript and stylesheets
@@ -173,67 +172,8 @@ gen_file('stylesheet',
# similarly for JavaScript files (but 1:1 mapping kept)
javascript_items.make_params(PACKAGE,PUBLIC,JAVASCRIPT_ROOT)
-# distro-specific stuff (mainly handled via specific setucfg)
-# note: *cfg values are special in that they are to be used
-# for standalone ``python setupy --gen_files fedoracfg''
-# which will generate desired ``setucfg'' version
-
-def make_release(collected, distchangelog):
- dist = via(collected, 'dist')
- if dist in ('fedora', 'rhel'):
- release = re.compile('^\*.*-(?P<rel>[1-9][0-9]*)\s*$', re.MULTILINE)
- ret = release.search(distchangelog)
- ret = ret and ret.group('rel') or ''
- else: # incl. dist == ''
- ret = ''
- return ret
-
-def make_patchapply(patchdef):
- patch_lines = re.compile('(^.*)Patch(\d+)\s+(\S+).*$', re.MULTILINE)
- patch_def2apply = (lambda m:
- m.group(1) + '%patch' + m.group(2) + ' -p1 -b ' + m.group(3)
- .replace('.patch', '')
- )
- return patch_lines.sub(patch_def2apply, patchdef)
-
-def make_longdesc(long_description):
- return (
- long_description.partition('\n\n')[2].partition('\n\n')[0]
- .replace('`', '').replace('_', '')
- )
-
-nonoptions(
- # general
- downloadurl = derive('download_url'),
- distchangelog = suffixfile('dist', 'CHANGES', default='CHANGES.txt', mod=fread),
- release = derive('distchangelog', chain=make_release),
- # short description (one-line)
- shortdesc = derive('description'),
- # long description (shorter than full description as passed to setup)
- # - first paragraph from README (TODO: textwrap?), lazily
- longdesc = derive('long_description', mod=make_longdesc),
- docfiles = suffixfile('dist', 'README', default='',
- args=['README.txt', 'LICENSE.txt'], mod=' '.join),
- # Fedora + RHEL
- patchdef = suffixfile('dist', 'patches', mod=fread),
- patchapply = derive('patchdef', mod=make_patchapply),
-)
gen_file('defaultcfg',
join('dist-files','setucfg'),
'setup.cfg',
subst=True, incl=False,
)
-# Fedora + RHEL
-gen_file('specfile',
- suffixfile('dist', 'dist-files','specfile.in'),
- PACKAGE + '.spec',
- subst=True, incl=False,
-)
-
-#
-# other parametrization
-#
-
-options_optional(
- disttag = "build tag",
-)
diff --git a/prepare-dist.py b/prepare-dist.py
new file mode 100644
index 0000000..a427caf
--- /dev/null
+++ b/prepare-dist.py
@@ -0,0 +1,69 @@
+# Copyright 2012 Red Hat, Inc.
+# Part of sunzi project
+# Licensed under GPLv2 (a copy included / http://gnu.org/licenses/gpl-2.0.txt)
+
+# to be exec'd provided by necessary functions (`options`, etc.)
+if __name__ == '__main__': # __builtin__ expected (?)
+ raise RuntimeError, "Not used in an expected way"
+
+import re
+
+# distro-specific stuff (mainly handled via specific setucfg)
+# note: *cfg values are special in that they are to be used
+# for standalone ``python setupy --gen_files fedoracfg''
+# which will generate desired ``setucfg'' version
+
+def make_release(collected, distchangelog):
+ dist = via(collected, 'dist')
+ if dist in ('fedora', 'rhel'):
+ release = re.compile('^\*.*-(?P<rel>[1-9][0-9]*)\s*$', re.MULTILINE)
+ ret = release.search(distchangelog)
+ ret = ret and ret.group('rel') or ''
+ else: # incl. dist == ''
+ ret = ''
+ return ret
+
+def make_patchapply(patchdef):
+ patch_lines = re.compile('(^.*)Patch(\d+)\s+(\S+).*$', re.MULTILINE)
+ patch_def2apply = (lambda m:
+ m.group(1) + '%patch' + m.group(2) + ' -p1 -b ' + m.group(3)
+ .replace('.patch', '')
+ )
+ return patch_lines.sub(patch_def2apply, patchdef)
+
+def make_longdesc(long_description):
+ return (
+ long_description.partition('\n\n')[2].partition('\n\n')[0]
+ .replace('`', '').replace('_', '')
+ )
+
+nonoptions(
+ # general
+ downloadurl = derive('download_url'),
+ distchangelog = suffixfile('dist', 'CHANGES', default='CHANGES.txt', mod=fread),
+ release = derive('distchangelog', chain=make_release),
+ # short description (one-line)
+ shortdesc = derive('description'),
+ # long description (shorter than full description as passed to setup)
+ # - first paragraph from README (TODO: textwrap?), lazily
+ longdesc = derive('long_description', mod=make_longdesc),
+ docfiles = suffixfile('dist', 'README', default='',
+ args=['README.txt', 'LICENSE.txt'], mod=' '.join),
+ # Fedora + RHEL
+ patchdef = suffixfile('dist', 'PATCHES', mod=fread),
+ patchapply = derive('patchdef', mod=make_patchapply),
+)
+# Fedora + RHEL
+gen_file('specfile',
+ suffixfile('dist', 'dist-files','specfile.in'),
+ PACKAGE + '.spec',
+ subst=True, incl=False,
+)
+
+#
+# other parametrization
+#
+
+options_optional(
+ disttag = "build tag",
+)
12 years, 1 month
[sunzi/development] multiple minor file moves/renames
by Jan Pokorný
commit 0fcf4b9e043febe0f2403682ad900ca4d71b3a60
Author: Jan Pokorný <jpokorny(a)redhat.com>
Date: Sat Feb 25 15:05:38 2012 +0100
multiple minor file moves/renames
toplevel _vimrc_local.vim moved to sunzi as this file
is colliding with vim modeline in the bash scripts
(unfortunately, _vimrc_local.vim takes precedence to
direct file modeline)
Signed-off-by: Jan Pokorný <jpokorny(a)redhat.com>
dist-files/{patches.dist => PATCHES.dist} | 0
{dist-files => input-files}/bootstrap-create.py | 0
{dist-files => input-files}/bootstrap-recipe.py | 0
_vimrc_local.vim => sunzi/_vimrc_local.vim | 0
4 files changed, 0 insertions(+), 0 deletions(-)
---
diff --git a/dist-files/patches.dist b/dist-files/PATCHES.dist
similarity index 100%
rename from dist-files/patches.dist
rename to dist-files/PATCHES.dist
diff --git a/dist-files/bootstrap-create.py b/input-files/bootstrap-create.py
similarity index 100%
rename from dist-files/bootstrap-create.py
rename to input-files/bootstrap-create.py
diff --git a/dist-files/bootstrap-recipe.py b/input-files/bootstrap-recipe.py
similarity index 100%
rename from dist-files/bootstrap-recipe.py
rename to input-files/bootstrap-recipe.py
diff --git a/_vimrc_local.vim b/sunzi/_vimrc_local.vim
similarity index 100%
rename from _vimrc_local.vim
rename to sunzi/_vimrc_local.vim
12 years, 1 month