[Checkins] SVN: Sandbox/adamg/zope.wineggbuilder/trunk/ checkpoint

Adam Groszer agroszer at gmail.com
Fri Jun 4 04:12:54 EDT 2010


Log message for revision 113087:
  checkpoint

Changed:
  U   Sandbox/adamg/zope.wineggbuilder/trunk/TODO.txt
  A   Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py
  A   Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py
  A   Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/tests.py

-=-
Modified: Sandbox/adamg/zope.wineggbuilder/trunk/TODO.txt
===================================================================
--- Sandbox/adamg/zope.wineggbuilder/trunk/TODO.txt	2010-06-04 06:44:29 UTC (rev 113086)
+++ Sandbox/adamg/zope.wineggbuilder/trunk/TODO.txt	2010-06-04 08:12:53 UTC (rev 113087)
@@ -1,17 +1,28 @@
 TODOs on the server:
 
-- setup .buildout
-  - egg folder -> c:\eggs
-  - no DL cache
+- windows basics
+  - kill unneeded services
+  - windows firewall
 
 - setup python's 2.4 -> 2.7?
   - setuptools
   - pywin32
+  - add one more 'system' python for buildbot etc, keep the others CLEAN
 
+- setup .buildout
+  - egg folder -> c:\eggs
+  - no DL cache
+
 - setup mingw32
   - don't add to PATH
 
 - setup VS C express
   - check that build_ext works only with --compiler
 
-- buildbot
\ No newline at end of file
+- buildbot
+
+- create user on PYPI
+  - setup .pypirc
+
+
+- setup some monitoring (mon.itor.us?)
\ No newline at end of file

Added: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py
===================================================================
--- Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py	                        (rev 0)
+++ Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py	2010-06-04 08:12:53 UTC (rev 113087)
@@ -0,0 +1,130 @@
+"""base classes
+
+$Id$
+"""
+__docformat__ = 'ReStructuredText'
+import StringIO
+import base64
+import httplib
+import logging
+import optparse
+import os
+import pkg_resources
+import subprocess
+import sys
+import urllib2
+import urlparse
+
+LOGGER = logging.Logger('build')
+
+class Command(object):
+    def __init__(self, cwd=None, captureOutput=True, exitOnError=True):
+        self.cwd = cwd
+        self.captureOutput = captureOutput
+        self.exitOnError = exitOnError
+
+    def do(cmd):
+        LOGGER.debug('Command: ' + cmd)
+        if self.captureOutput:
+            stdout = stderr = subprocess.PIPE
+        else:
+            stdout = stderr = None
+        p = subprocess.Popen(
+            cmd, stdout=stdout, stderr=stderr,
+            shell=True, cwd=self.cwd)
+        stdout, stderr = p.communicate()
+        if stdout is None:
+            stdout = "See output above"
+        if stderr is None:
+            stderr = "See output above"
+        if p.returncode != 0:
+            LOGGER.error(u'An error occurred while running command: %s' %cmd)
+            LOGGER.error('Error Output: \n%s' % stderr)
+            if self.exitOnError:
+                sys.exit(p.returncode)
+            else:
+                raise OSError(p.returncode)
+        LOGGER.debug('Output: \n%s' % stdout)
+        return stdout
+
+class SVN(object):
+
+    user = None
+    passwd = None
+    forceAuth = False
+    #hook to enable testing
+    commandKlass = Command
+
+    #TODO: spaces in urls+folder names???
+
+    def __init__(self, user=None, passwd=None,
+                 forceAuth=False, exitOnError=True):
+        self.user = user
+        self.passwd = passwd
+        self.forceAuth = forceAuth
+        self.cmd = self.commandKlass(exitOnError=exitOnError)
+
+    def _addAuth(self, command):
+        auth = ''
+        if self.user:
+            auth = '--username %s --password %s' % (self.user, self.passwd)
+
+            if self.forceAuth:
+                auth += ' --no-auth-cache'
+
+        command = command.replace('##__auth__##', auth)
+        return command
+
+    def info(self, url):
+        command = 'svn info --non-interactive ##__auth__## --xml %s' % url
+        command = self._addAuth(command)
+        return self.cmd.do(command)
+
+    def ls(self, url):
+        command = 'svn ls --non-interactive ##__auth__## --xml %s' % url
+        command = self._addAuth(command)
+        return self.cmd.do(command)
+
+    def cp(self, fromurl, tourl, comment):
+        command = 'svn cp --non-interactive ##__auth__## -m "%s" %s %s' %(
+            comment, fromurl, tourl)
+        command = self._addAuth(command)
+        self.cmd.do(command)
+
+    def co(self, url, folder):
+        command = 'svn co --non-interactive ##__auth__## %s %s' % (url, folder)
+        command = self._addAuth(command)
+        self.cmd.do(command)
+
+    def ci(self, folder, comment):
+        command = 'svn ci --non-interactive ##__auth__## -m "%s" %s' % (
+            comment, folder)
+        command = self._addAuth(command)
+        self.cmd.do(command)
+
+def getInput(prompt, default, useDefaults):
+    if useDefaults:
+        return default
+    defaultStr = ''
+    if default:
+        defaultStr = ' [' + default + ']'
+    value = raw_input(prompt + defaultStr + ': ')
+    if not value:
+        return default
+    return value
+
+
+def checkRO(function, path, excinfo):
+    if (function == os.remove
+        and excinfo[0] == WindowsError
+        and excinfo[1].winerror == 5):
+        #Access is denied
+        #because it's a readonly file
+        os.chmod(path, stat.S_IWRITE)
+        os.remove(path)
+
+def rmtree(dirname):
+    if is_win32:
+        shutil.rmtree(dirname, ignore_errors=False, onerror=checkRO)
+    else:
+        shutil.rmtree(dirname)


Property changes on: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/base.py
___________________________________________________________________
Added: svn:keywords
   + Date Author Id Revision
Added: svn:eol-style
   + native

Added: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py
===================================================================
--- Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py	                        (rev 0)
+++ Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py	2010-06-04 08:12:53 UTC (rev 113087)
@@ -0,0 +1,20 @@
+"""base classes
+
+$Id$
+"""
+__docformat__ = 'ReStructuredText'
+import StringIO
+import base64
+import httplib
+import logging
+import optparse
+import os
+import pkg_resources
+import subprocess
+import sys
+import urllib2
+import urlparse
+
+from zope.wineggbuilder import base
+
+LOGGER = logging.Logger('build')


Property changes on: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/build.py
___________________________________________________________________
Added: svn:keywords
   + Date Author Id Revision
Added: svn:eol-style
   + native

Added: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/tests.py
===================================================================
--- Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/tests.py	                        (rev 0)
+++ Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/tests.py	2010-06-04 08:12:53 UTC (rev 113087)
@@ -0,0 +1,43 @@
+"""tests
+
+$Id$
+"""
+__docformat__ = 'ReStructuredText'
+
+import unittest
+import doctest
+import pprint
+
+#format is [(expected cmd, result)]
+CommandIO = []
+
+class MockCommand(object):
+    def __init__(self):
+        pass
+
+    def do(cmd):
+        global CommandIO
+        next = CommandIO.pop(0)
+        if next[0] != cmd:
+            raise ValueError("Wrong command, expected: %s, got: %s",
+                             (next[0], cmd))
+
+        if isinstance(next[1], Exception):
+            raise next[1]
+
+        return next[1]
+
+
+    def __call__(self, cwd=None, captureOutput=True, exitOnError=True):
+        return self
+
+def test_suite():
+    return unittest.TestSuite((
+        doctest.DocFileSuite('README.txt',
+                     optionflags=doctest.NORMALIZE_WHITESPACE|doctest.ELLIPSIS,
+                     globs={'pprint': pprint}
+                     ),
+        ))
+
+if __name__ == '__main__':
+    unittest.main(defaultTest='test_suite')


Property changes on: Sandbox/adamg/zope.wineggbuilder/trunk/src/zope/wineggbuilder/tests.py
___________________________________________________________________
Added: svn:keywords
   + Date Author Id Revision
Added: svn:eol-style
   + native



More information about the checkins mailing list