[cig-commits] [commit] baagaard/fix-packaging: Updated packaging scripts for cygwin. (8fa3b45)
cig_noreply at geodynamics.org
cig_noreply at geodynamics.org
Tue Mar 18 13:57:43 PDT 2014
Repository : ssh://geoshell/pylith
On branch : baagaard/fix-packaging
Link : https://github.com/geodynamics/pylith/compare/0000000000000000000000000000000000000000...8fa3b45d5d66427c3c96a780aedc683485976fea
>---------------------------------------------------------------
commit 8fa3b45d5d66427c3c96a780aedc683485976fea
Author: Brad Aagaard <baagaard at usgs.gov>
Date: Tue Mar 18 13:57:28 2014 -0700
Updated packaging scripts for cygwin.
Completed migration from buildbot scripts that are PyLith specific to
packaging scripts in source distribution that are run manually at
release time.
>---------------------------------------------------------------
8fa3b45d5d66427c3c96a780aedc683485976fea
packager/cygwin.py | 106 ++++++++++++++++++++++++++
packager/make_package.py | 86 +--------------------
{doc/developer => packager}/make_petscdist.sh | 0
3 files changed, 110 insertions(+), 82 deletions(-)
diff --git a/packager/cygwin.py b/packager/cygwin.py
index 3e0a67d..f83bdf9 100644
--- a/packager/cygwin.py
+++ b/packager/cygwin.py
@@ -21,8 +21,114 @@
import os, sys
from os.path import basename, dirname, isabs, isdir, isfile, join
+from popen2 import Popen4
import shutil
+def ospawn(*argv):
+ print ' '.join(argv)
+ child = Popen4(argv)
+
+ child.tochild.close()
+
+ output = child.fromchild.readlines()
+ status = child.wait()
+
+ exitStatus = None
+ if (os.WIFSIGNALED(status)):
+ statusStr = "signal %d" % os.WTERMSIG(status)
+ elif (os.WIFEXITED(status)):
+ exitStatus = os.WEXITSTATUS(status)
+ statusStr = "exit %d" % exitStatus
+ else:
+ statusStr = "status %d" % status
+ if exitStatus != 0:
+ sys.exit("%s: %s: %s" % (sys.argv[0], argv[0], statusStr))
+
+ return output
+
+
+def cygpath(*args):
+ output = ospawn("cygpath", *args)
+ return output[0].rstrip()
+
+
+def itwindirs(l, sourceDir):
+ for src in l:
+ if isinstance(src, tuple):
+ src, dest = src
+ elif isabs(src):
+ dest = src[1:]
+ else:
+ dest = src
+ src = cygpath("-w", src)
+ if src.startswith(sourceDir):
+ src = src[len(sourceDir)+1:]
+ dest = "{app}\\" + dest.replace("/", "\\")
+ yield src, dest
+ return
+
+
+def itwinfiles(l, sourceDir):
+ for src in l:
+ if isinstance(src, tuple):
+ src, dest = src
+ elif isabs(src):
+ dest = dirname(src)[1:]
+ else:
+ dest = dirname(src)
+ src = cygpath("-w", src)
+ if src.startswith(sourceDir):
+ src = src[len(sourceDir)+1:]
+ dest = "{app}\\" + dest.replace("/", "\\")
+ yield src, dest
+ return
+
+
+def copyAll(srcList, prefix):
+ for src in srcList:
+ if isinstance(src, tuple):
+ src, dest = src
+ elif isabs(src):
+ dest = dirname(src)[1:]
+ else:
+ dest = dirname(src)
+ if not isabs(src):
+ src = join(prefix, src)
+ if not isdir(dest):
+ os.makedirs(dest)
+
+ if not isdir(src):
+ shutil.copy(src, dest) # faster than os.system() for small files
+ else:
+ os.system("cp -r %s %s" % (src, dest))
+ return
+
+
+def generateBashrc(prefix, package, info):
+ bashrc = "." + package.lower() + "rc"
+ s = open(prefix + "/" + bashrc, "w")
+
+ stuff = {
+ "line": "-" * len(info["AppVerName"]),
+ }
+ stuff.update(info)
+
+ s.write(
+r"""
+
+export PATH=/usr/bin:/bin:/lib:/lib/lapack:$PATH
+
+echo %(line)s
+echo %(AppVerName)s
+echo %(line)s
+
+PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
+""" % stuff
+ )
+
+ return bashrc
+
+
def installCigIcon(prefix):
cigIco = "cig.ico"
os.system("cp %s %s" % (cigIco, prefix))
diff --git a/packager/make_package.py b/packager/make_package.py
old mode 100644
new mode 100755
index 1c75d4b..74e6c53
--- a/packager/make_package.py
+++ b/packager/make_package.py
@@ -17,6 +17,8 @@
#
# Create PyLith binary package.
#
+# Run from the top-level PyLith build dir.
+#
# Usage: make_package.py
import os, sys, platform
@@ -251,11 +253,6 @@ def ospawn(*argv):
return output
-def cygpath(*args):
- output = ospawn("cygpath", *args)
- return output[0].rstrip()
-
-
def getGitInfo(srcdir):
workdir = os.getcwd()
os.chdir(srcdir)
@@ -269,83 +266,6 @@ def getGitInfo(srcdir):
return revision
-def itwindirs(l, sourceDir):
- for src in l:
- if isinstance(src, tuple):
- src, dest = src
- elif isabs(src):
- dest = src[1:]
- else:
- dest = src
- src = cygpath("-w", src)
- if src.startswith(sourceDir):
- src = src[len(sourceDir)+1:]
- dest = "{app}\\" + dest.replace("/", "\\")
- yield src, dest
- return
-
-
-def itwinfiles(l, sourceDir):
- for src in l:
- if isinstance(src, tuple):
- src, dest = src
- elif isabs(src):
- dest = dirname(src)[1:]
- else:
- dest = dirname(src)
- src = cygpath("-w", src)
- if src.startswith(sourceDir):
- src = src[len(sourceDir)+1:]
- dest = "{app}\\" + dest.replace("/", "\\")
- yield src, dest
- return
-
-
-def copyAll(srcList, prefix):
- for src in srcList:
- if isinstance(src, tuple):
- src, dest = src
- elif isabs(src):
- dest = dirname(src)[1:]
- else:
- dest = dirname(src)
- if not isabs(src):
- src = join(prefix, src)
- if not isdir(dest):
- os.makedirs(dest)
-
- if not isdir(src):
- shutil.copy(src, dest) # faster than os.system() for small files
- else:
- os.system("cp -r %s %s" % (src, dest))
- return
-
-
-def generateBashrc(prefix, package, info):
- bashrc = "." + package.lower() + "rc"
- s = open(prefix + "/" + bashrc, "w")
-
- stuff = {
- "line": "-" * len(info["AppVerName"]),
- }
- stuff.update(info)
-
- s.write(
-r"""
-
-export PATH=/usr/bin:/bin:/lib:/lib/lapack:$PATH
-
-echo %(line)s
-echo %(AppVerName)s
-echo %(line)s
-
-PS1='\[\e]0;\w\a\]\n\[\e[32m\]\u@\h \[\e[33m\]\w\[\e[0m\]\n\$ '
-""" % stuff
- )
-
- return bashrc
-
-
def stripBinaries(pl, opSys):
strip = "strip"
if opSys == "darwin":
@@ -469,6 +389,8 @@ def mkpkg():
shutil.rmtree("src", ignore_errors=True)
elif opSys == "win":
+ name = "pylith"
+ version = makeinfo['version']
stage = cygwin.stageInstallation(prefix, workdir, python, pl)
cygwin.createInstaller(python, stage, workdir, name, package, version, pl,
revision + "-" + distdir_arch)
diff --git a/doc/developer/make_petscdist.sh b/packager/make_petscdist.sh
similarity index 100%
rename from doc/developer/make_petscdist.sh
rename to packager/make_petscdist.sh
More information about the CIG-COMMITS
mailing list