diff options
author | Chris Larson <chris_larson@mentor.com> | 2011-03-16 08:07:29 -0700 |
---|---|---|
committer | Chris Larson <chris_larson@mentor.com> | 2011-03-16 08:31:52 -0700 |
commit | f229824dc9c453adf6067500e2bf6761536e4f2f (patch) | |
tree | 3c1d741421734598a17df847ce09a0f7e07170a1 | |
parent | 967cd1aa2c59f15d805862bd9935f507c635c762 (diff) | |
download | bitbake-f229824dc9c453adf6067500e2bf6761536e4f2f.tar.gz |
Initial work on getting bitbake working under pypy
- use os.chmod, not os.fchmod, as the latter is missing under pypy
- rearrange our imports a bit
- don't die if sqlite3 is missing shared cache support
Signed-off-by: Chris Larson <chris_larson@mentor.com>
-rw-r--r-- | lib/bb/build.py | 3 | ||||
-rw-r--r-- | lib/bb/fetch2/__init__.py | 40 | ||||
-rw-r--r-- | lib/bb/persist_data.py | 3 |
3 files changed, 23 insertions, 23 deletions
diff --git a/lib/bb/build.py b/lib/bb/build.py index 20906377f..042edb8f8 100644 --- a/lib/bb/build.py +++ b/lib/bb/build.py @@ -219,7 +219,8 @@ def exec_func_shell(function, d, runfile, cwd=None, fakeroot=False): if cwd: script.write("cd %s\n" % cwd) script.write("%s\n" % function) - os.fchmod(script.fileno(), 0775) + + os.chmod(runfile, 0775) if fakeroot: cmd = ['fakeroot', runfile] diff --git a/lib/bb/fetch2/__init__.py b/lib/bb/fetch2/__init__.py index d4f28e823..9768b087b 100644 --- a/lib/bb/fetch2/__init__.py +++ b/lib/bb/fetch2/__init__.py @@ -28,10 +28,8 @@ from __future__ import absolute_import from __future__ import print_function import os, re import logging -import bb -from bb import data -from bb import persist_data -from bb import utils +import bb.data, bb.persist_data, bb.utils +from bb import data __version__ = "2" @@ -230,7 +228,7 @@ def fetcher_init(d): logger.debug(1, "Keeping SRCREV cache due to cache policy of: %s", srcrev_policy) elif srcrev_policy == "clear": logger.debug(1, "Clearing SRCREV cache due to cache policy of: %s", srcrev_policy) - revs = persist_data.persist('BB_URI_HEADREVS', d) + revs = bb.persist_data.persist('BB_URI_HEADREVS', d) try: bb.fetch2.saved_headrevs = revs.items() except: @@ -249,7 +247,7 @@ def fetcher_compare_revisions(d): return true/false on whether they've changed. """ - data = persist_data.persist('BB_URI_HEADREVS', d).items() + data = bb.persist_data.persist('BB_URI_HEADREVS', d).items() data2 = bb.fetch2.saved_headrevs changed = False @@ -351,7 +349,7 @@ def get_srcrev(d): def localpath(url, d): fetcher = bb.fetch2.Fetch([url], d) - return fetcher.localpath(url) + return fetcher.localpath(url) def runfetchcmd(cmd, d, quiet = False, cleanup = []): """ @@ -371,7 +369,7 @@ def runfetchcmd(cmd, d, quiet = False, cleanup = []): 'SSH_AUTH_SOCK', 'SSH_AGENT_PID', 'HOME'] for var in exportvars: - val = data.getVar(var, d, True) + val = bb.data.getVar(var, d, True) if val: cmd = 'export ' + var + '=\"%s\"; %s' % (val, cmd) @@ -497,15 +495,15 @@ def srcrev_internal_helper(ud, d, name): return ud.parm['tag'] rev = None - pn = data.getVar("PN", d, True) + pn = bb.data.getVar("PN", d, True) if name != '': - rev = data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True) + rev = bb.data.getVar("SRCREV_%s_pn-%s" % (name, pn), d, True) if not rev: - rev = data.getVar("SRCREV_%s" % name, d, True) + rev = bb.data.getVar("SRCREV_%s" % name, d, True) if not rev: - rev = data.getVar("SRCREV_pn-%s" % pn, d, True) + rev = bb.data.getVar("SRCREV_pn-%s" % pn, d, True) if not rev: - rev = data.getVar("SRCREV", d, True) + rev = bb.data.getVar("SRCREV", d, True) if rev == "INVALID": raise FetchError("Please set SRCREV to a valid value", ud.url) if rev == "AUTOINC": @@ -591,12 +589,12 @@ class FetchData(object): if "srcdate" in self.parm: return self.parm['srcdate'] - pn = data.getVar("PN", d, True) + pn = bb.data.getVar("PN", d, True) if pn: - return data.getVar("SRCDATE_%s" % pn, d, True) or data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True) + return bb.data.getVar("SRCDATE_%s" % pn, d, True) or bb.data.getVar("SRCDATE", d, True) or bb.data.getVar("DATE", d, True) - return data.getVar("SRCDATE", d, True) or data.getVar("DATE", d, True) + return bb.data.getVar("SRCDATE", d, True) or bb.data.getVar("DATE", d, True) class FetchMethod(object): """Base class for 'fetch'ing data""" @@ -789,10 +787,10 @@ class FetchMethod(object): localcount = None if name != '': - pn = data.getVar("PN", d, True) - localcount = data.getVar("LOCALCOUNT_" + name, d, True) + pn = bb.data.getVar("PN", d, True) + localcount = bb.data.getVar("LOCALCOUNT_" + name, d, True) if not localcount: - localcount = data.getVar("LOCALCOUNT", d, True) + localcount = bb.data.getVar("LOCALCOUNT", d, True) return localcount localcount_internal_helper = staticmethod(localcount_internal_helper) @@ -804,7 +802,7 @@ class FetchMethod(object): if not hasattr(self, "_latest_revision"): raise ParameterError("The fetcher for this URL does not support _latest_revision", url) - revs = persist_data.persist('BB_URI_HEADREVS', d) + revs = bb.persist_data.persist('BB_URI_HEADREVS', d) key = self.generate_revision_key(url, ud, d, name) rev = revs[key] if rev != None: @@ -820,7 +818,7 @@ class FetchMethod(object): if hasattr(self, "_sortable_revision"): return self._sortable_revision(url, ud, d) - localcounts = persist_data.persist('BB_URI_LOCALCOUNT', d) + localcounts = bb.persist_data.persist('BB_URI_LOCALCOUNT', d) key = self.generate_revision_key(url, ud, d, name) latest_rev = self._build_revision(url, ud, d, name) diff --git a/lib/bb/persist_data.py b/lib/bb/persist_data.py index bd60fca7c..38ad35490 100644 --- a/lib/bb/persist_data.py +++ b/lib/bb/persist_data.py @@ -39,7 +39,8 @@ if sqlversion[0] < 3 or (sqlversion[0] == 3 and sqlversion[1] < 3): logger = logging.getLogger("BitBake.PersistData") -sqlite3.enable_shared_cache(True) +if hasattr(sqlite3, 'enable_shared_cache'): + sqlite3.enable_shared_cache(True) class SQLTable(collections.MutableMapping): |