Exemplo n.º 1
0
 def fingerprint_iter():
   for req in self:
     hash_items = (
       repr(req._requirement),
       req._repository,
       req._name,
       req._use_2to3,
       req.compatibility,
     )
     yield stable_json_hash(hash_items)
Exemplo n.º 2
0
 def fingerprint_iter():
     for req in self:
         hash_items = (
             repr(req._requirement),
             req._repository,
             req._name,
             req._use_2to3,
             req.compatibility,
         )
         yield stable_json_hash(hash_items)
Exemplo n.º 3
0
 def cache_key(self):
   excludes = [(e.org, e.name) for e in self.excludes]
   return stable_json_hash(dict(org=self.org,
                                name=self.name,
                                rev=self.rev,
                                force=self.force,
                                ext=self.ext,
                                url=self.get_url(relative=True),
                                classifier=self.classifier,
                                transitive=self.transitive,
                                mutable=self.mutable,
                                excludes=excludes))
Exemplo n.º 4
0
  def _compute_fingerprint(self):
    data = (self.org, self.name)

    # NB: The None occupies the legacy rev 3rd slot.  The rev was never populated and always None,
    # so maintaining the slot and its value just serve to preserve the fingerprint and thus
    # containing targets in caches out in the world.
    data += (None,)

    if self.publication_metadata:
      fingerprint = self.publication_metadata.fingerprint()
      if fingerprint:
        data += (fingerprint,)
    return stable_json_hash(data)
Exemplo n.º 5
0
    def _compute_fingerprint(self):
        data = (self.org, self.name)

        # NB: The None occupies the legacy rev 3rd slot.  The rev was never populated and always None,
        # so maintaining the slot and its value just serve to preserve the fingerprint and thus
        # containing targets in caches out in the world.
        data += (None, )

        if self.publication_metadata:
            fingerprint = self.publication_metadata.fingerprint()
            if fingerprint:
                data += (fingerprint, )
        return stable_json_hash(data)
Exemplo n.º 6
0
 def cache_key(self):
     excludes = [(e.org, e.name) for e in self.excludes]
     return stable_json_hash(
         dict(org=self.org,
              name=self.name,
              rev=self.rev,
              force=self.force,
              ext=self.ext,
              url=self.get_url(relative=True),
              classifier=self.classifier,
              transitive=self.transitive,
              mutable=self.mutable,
              excludes=excludes))
Exemplo n.º 7
0
  def analysis_hash(self, reqs):
    hasher = sha1()
    reqs_hash = stable_json_hash([sorted(list(reqs))])
    hasher.update(reqs_hash)

    # This adds the python version to the hash.
    venv_version_file = os.path.join(os.path.dirname(os.__file__), 'orig-prefix.txt')
    with open(venv_version_file, 'rb') as f:
      version_string = f.read()
      hasher.update(version_string)

    # Add virtualenv roots to the hash. Analysis should be redone if pointed at a new venv, even if all else the same.
    for venv in self.python_virtual_envs:
      hasher.update(venv)

    # Invalidate if pants changes.
    hasher.update(self.get_options().pants_version)
    hasher.update(self.get_options().cache_key_gen_version)

    # Invalidate the cache if the task version is bumped.
    hasher.update(str(self.implementation_version()))
    return hasher.hexdigest()
Exemplo n.º 8
0
  def analysis_hash(self, reqs):
    hasher = sha1()
    reqs_hash = stable_json_hash([sorted(list(reqs))])
    hasher.update(reqs_hash)

    # This adds the python version to the hash.
    venv_version_file = os.path.join(os.path.dirname(os.__file__), 'orig-prefix.txt')
    with open(venv_version_file, 'rb') as f:
      version_string = f.read()
      hasher.update(version_string)

    # Add virtualenv roots to the hash. Analysis should be redone if pointed at a new venv, even if all else the same.
    for venv in self.python_virtual_envs:
      hasher.update(venv)

    # Invalidate if pants changes.
    hasher.update(self.get_options().pants_version)
    hasher.update(self.get_options().cache_key_gen_version)

    # Invalidate the cache if the task version is bumped.
    hasher.update(str(self.implementation_version()))
    return hasher.hexdigest()
Exemplo n.º 9
0
 def compute_fingerprint(self, target):
   return stable_json_hash(sorted(target.tags))
Exemplo n.º 10
0
 def fingerprint(self):
     # TODO: url_builder is not a part of fingerprint.
     return stable_json_hash(self.name)
Exemplo n.º 11
0
 def fingerprint(self):
     return combine_hashes(
         [self.wiki.fingerprint(),
          stable_json_hash(self.config)])
Exemplo n.º 12
0
 def fingerprint_iter():
     for req in self:
         assert (isinstance(req, ZefRequirement))
         yield stable_json_hash(repr(req))
Exemplo n.º 13
0
 def compute_fingerprint(self, target):
   return stable_json_hash(target.services)
Exemplo n.º 14
0
 def _compute_fingerprint(self):
   return stable_json_hash(tuple(jar.cache_key() for jar in self))
Exemplo n.º 15
0
 def fingerprint(self):
   # TODO: url_builder is not a part of fingerprint.
   return stable_json_hash(self.name)
 def _compute_fingerprint(self):
   return stable_json_hash(tuple(hash(req) for req in self))
Exemplo n.º 17
0
def stable_json_sha1(obj):
    """
  :API: public
  """
    return stable_json_hash(obj)
Exemplo n.º 18
0
 def _compute_fingerprint(self):
     return stable_json_hash(self._underlying)
Exemplo n.º 19
0
 def _compute_fingerprint(self):
     return stable_json_hash(tuple(jar.cache_key() for jar in self))
Exemplo n.º 20
0
 def _compute_fingerprint(self):
     return stable_json_hash(tuple(repr(exclude) for exclude in self))
Exemplo n.º 21
0
 def _compute_fingerprint(self):
   return stable_json_hash(tuple(repr(exclude) for exclude in self))
Exemplo n.º 22
0
 def compute_fingerprint(self, target):
     return stable_json_hash(target.services)
Exemplo n.º 23
0
 def _compute_fingerprint(self):
   return stable_json_hash(self._underlying)
Exemplo n.º 24
0
 def fingerprint(self):
   return combine_hashes([self.wiki.fingerprint(), stable_json_hash(self.config)])