Get the currect version from file

@access private
@param string $package
@return Datetime $version
192754
private static function file_get_version($package) {
		if (file_exists(Config::$migration_directory . '/db_version')) {
			$version_file = trim(file_get_contents(Config::$migration_directory . '/db_version'));
			$version = json_decode($version_file, true);
		} else {
			$version = null;
		}

		if ($version === null and file_exists(Config::$migration_directory . '/db_version')) {
			// This is an old db_version file, let's update it
			$version = [
				'project' => $version_file
			];
			file_put_contents(Config::$migration_directory . '/db_version', json_encode($version));
		}

		if (empty($version[$package])) {
			return null;
		}

		return \DateTime::createFromFormat('Ymd His', $version[$package]);
	}
698012
def get_package_version(self, package):
        # type: (str) -> Tuple[int, ...]
        
        name = "{0}{1}".format(
            pelix.remote.PROP_ENDPOINT_PACKAGE_VERSION_, package
        )
        try:
            # Get the version string
            version = self.__properties[name]

            # Split dots ('.')
            return tuple(version.split("."))
        except KeyError:
            # No version
            return 0, 0, 0
822147
private function getDescSortedVersions(array $packages): array
    {
        usort($packages, function (PackageInterface $a, PackageInterface $b) {
            return version_compare($b->getVersion(), $a->getVersion());
        });

        return $packages;
    }
751328
public function getAtVersion($from)
    {
        // Null implies return current version
        if (is_null($from)) {
            return $this->owner;
        }

        $baseClass = $this->owner->baseClass();
        $id = $this->owner->ID ?: $this->owner->OldID;

        // By version number
        if (is_numeric($from)) {
            return Versioned::get_version($baseClass, $id, $from);
        }

        // By stage
        return Versioned::get_by_stage($baseClass, $from)->byID($id);
    }
452545
def find_version(
        package_name: str, version_module_name: str = '_version',
        version_variable_name: str = 'VERSION') -> str:
    """"""
    version_module = importlib.import_module(
        '{}.{}'.format(package_name.replace('-', '_'), version_module_name))
    return getattr(version_module, version_variable_name)
699615
public function getRegistry($package = null)
    {
        if (isset($package)) {
            if ($this->registered($package)) {
                return $this->registry[ $package ];
            }

            return false;
        }

        return $this->registry;
    }
1244233
protected function buildPackage(array $package) {
    if (isset($package['source'])) {
      $info = [
        'download' => [
          'type' => 'git',
          'url' => $package['source']['url'],
          'branch' => $package['version'],
          'revision' => $package['source']['reference'],
        ],
      ];
    }
    elseif (isset($package['dist'])) {
      $info = [
        'download' => [
          'type' => 'get',
          'url' => $package['dist']['url'],
        ],
      ];
    }

    if (isset($package['extra']['patches_applied'])) {
      $info['patch'] = array_values($package['extra']['patches_applied']);
    }
    return $info;
  }
57981
protected static function cleanExtraVersion($version)
    {
        $pos = strpos($version, '-');

        if (false !== $pos) {
            $version = substr($version, 0, $pos);
        }

        return $version;
    }
795321
protected function getPackageInfo($package) {
		
		$org  = "";
		$repo = "";
		$tag  = "master";
		
		if (strpos($package, "#") !== false) {
			list($package,$tag) = explode("#",$package);
		}
		
		if (strpos($package, "/") !== false) {
			list($org,$repo) = explode("/",$package);
		} else {
			Console::writeError("please provide a real path to a package...");
		}
		
		return array($org,$repo,$tag);
		
	}
597975
protected function readFromSource(array $source, string $package) : ?string
    {
        // Abort if no name property
        if(!isset($source['name'])){
            return null;
        }

        // Abort if name is not the same a package name
        if($source['name'] != $package){
            return null;
        }

        // At this point it means that the package matches.
        // We check for a version property.
        if(isset($source['version'])){
            return $source['version'];
        }

        // This means that no version property existed - which
        // could mean that the source is an actual composer file.
        // Therefore, we check if there is an branch alias
        // specified. (dev-master assumed)
        if(isset($source['extra']['branch-alias']['dev-master'])){
            return $source['extra']['branch-alias']['dev-master'];
        }

        // Sadly, if reached here then there is no version available
        // nor a branch alias. Therefore, we can only return a default
        // version...
        return self::DEFAULT_VERSION;
    }
181454
private function getPackageDevName(string $package) {
		$bundle = explode("/", $package)[1];
		$explode = explode("-", $bundle);
		
		$package_name = "";
		
		foreach ($explode as $string) {
			$package_name .= ucfirst($string);
		}
		
		return $package_name;
	}
1301005
public static function getByVersionNumber($version)
    {
        $updates = id(new Update())->getLocalAvailableUpdates();
        foreach ($updates as $up) {
            if ($up->getUpdateVersion() == $version) {
                return $up;
            }
        }
    }
404554
def get_version(package_name, version_file='_version.py'):
    """"""
    filename = os.path.join(os.path.dirname(__file__), package_name, version_file)
    with open(filename, 'rb') as fp:
        return fp.read().decode('utf8').split('=')[1].strip(" \n'")
781182
def get_package_version(verfile):
  ''''''
  version = None
  with open(verfile) as fh:
      try:
          version = [line.split('=')[1].strip().strip("'") for line in fh if \
              line.startswith('__version__')][0]
      except IndexError:
          pass
  return version
332679
protected static function getSplittedVersion($version)
    {
        $version = static::cleanExtraVersion($version);
        $version = str_replace(array('*', 'x', 'X'), '9999999', $version);
        $exp = explode('.', $version);

        return $exp;
    }
15774
protected function requirePackage(Package $package)
    {
        $version = $this->chooseVersion($package);
        passthru(sprintf(
            'composer require %s:%s',
            $package->getName(),
            $version
        ));
        $this->comment('Package ' . $package->getName() . ' installed');
        $versions = $package->getVersions();
        $v = array_get($versions, $version);

        // Run post-process in separate command to load it with new autoloader
        passthru(sprintf(
            'php artisan package:process %s %s',
            $package->getName(),
            base64_encode(serialize($v))
        ));
    }
658535
def _get_version():
    """"""
    with open(os.path.join(os.path.dirname(__file__), PACKAGE_NAME, 'VERSION'), 'rb') as f:
        version = f.read().decode('ascii').strip()
    return version