def build_pkg_list(self, check_timestamp): ''' Build list of packages to build from config file. ''' for p in self.all_packages: x = config.config(p.name, 'Build') if x != '' and eval(x): if check_timestamp: verbose(1, 'Checking required packages for %s: ' % p.name) self.add_build(p, check_timestamp)
def svn_up(f): exe = os.popen("svn update") for line in exe: if (line[0] == 'U' or line[0] == 'A') and line[1] == ' ': write_update(f, line.split()[1], "Updated") elif line[0] == 'D' and line[1] == ' ': write_update(f, line.split()[1], "Deleted") ret = exe.close() if ret: verbose("\"svn update\" Failed. Return code %s" % ret >> 8) exe = os.popen("svn status") for line in exe: if line[0] == 'M': write_update(f, line.split()[1], "Modified") elif line[0] == 'C': write_update(f, line.split()[1], "Conflicting") ret = exe.close() if ret: verbose("\"svn status\" Failed. Return code %s" % ret >> 8) write_update(f)
def add_build(self, pkg, check_timestamp, force=False): ''' Add a package to the build list if it or its dependencies have changed. ''' debug ('add_build %s [%s] %s' % (pkg, pkg.deps, force)) if self.database[pkg.name + '-status'] == 'installed': return 0 if not force and pkg.installed(): path = python_path(pkg.name) if os.path.commonprefix([path,self.libdir]) != self.libdir: return 0 deps_needed = 0 for p in pkg.deps: deps_needed += self.add_build(p, check_timestamp, force) if check_timestamp and deps_needed == 0: f, t = dirwalk.DirWalk(pkg.psdir).find_newest() debug('%s: %s\t%s' % (pkg.psdir, f, time.strftime("%b %d %Y %H:%M %Z", time.localtime(t)))) if t < self.database[pkg.name] and self.database[pkg.name + '-status'] == pkg.status(): return 0 if not pkg in self.packages: if check_timestamp: if self.database[pkg.name + '-status'] == pkg.status(): verbose(1, '\t%s needs rebuilt' % pkg.name) elif self.database[pkg.name + '-status'] == '': verbose(1, '\t%s needs built' % pkg.name) else: verbose(1, "\t%s needs rebuilt. Status changed from '%s' to '%s.'" % (pkg.name, self.database[pkg.name + '-status'], pkg.status())) self.packages.append(pkg) if pkg.name == 'python': # FIXME: major hack self.add_build([p for p in self.all_packages if p.name == 'matplotlib'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'scipy'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'nose'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'sympy'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'numpy'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'tcl'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'tk'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'h5py'][0], check_timestamp, True) self.add_build([p for p in self.all_packages if p.name == 'setuptools'][0], check_timestamp, True) return 1
def add_build(self, pkg, check_timestamp, force=False): ''' Add a package to the build list if it or its dependencies have changed. ''' debug('add_build %s [%s] %s' % (pkg, pkg.deps, force)) if self.database[pkg.name + '-status'] == 'installed': return 0 if not force and pkg.installed(): path = python_path(pkg.name) if os.path.commonprefix([path, self.libdir]) != self.libdir: return 0 deps_needed = 0 for p in pkg.deps: deps_needed += self.add_build(p, check_timestamp, force) if check_timestamp and deps_needed == 0: f, t = dirwalk.DirWalk(pkg.psdir).find_newest() debug('%s: %s\t%s' % (pkg.psdir, f, time.strftime("%b %d %Y %H:%M %Z", time.localtime(t)))) if t < self.database[pkg.name] and self.database[ pkg.name + '-status'] == pkg.status(): return 0 if not pkg in self.packages: if check_timestamp: if self.database[pkg.name + '-status'] == pkg.status(): verbose(1, '\t%s needs rebuilt' % pkg.name) elif self.database[pkg.name + '-status'] == '': verbose(1, '\t%s needs built' % pkg.name) else: verbose( 1, "\t%s needs rebuilt. Status changed from '%s' to '%s.'" % (pkg.name, self.database[pkg.name + '-status'], pkg.status())) self.packages.append(pkg) if pkg.name == 'python': # FIXME: major hack self.add_build([ p for p in self.all_packages if p.name == 'matplotlib' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'scipy' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'nose' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'sympy' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'numpy' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'tcl' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'tk' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'h5py' ][0], check_timestamp, True) self.add_build([ p for p in self.all_packages if p.name == 'setuptools' ][0], check_timestamp, True) return 1