mirror of
				https://github.com/f-droid/fdroidserver.git
				synced 2025-11-04 14:30:30 +03:00 
			
		
		
		
	standardize on versionCode as spelling
This commit is contained in:
		
							parent
							
								
									e8d4d8fc6a
								
							
						
					
					
						commit
						1068057524
					
				
					 5 changed files with 14 additions and 14 deletions
				
			
		| 
						 | 
					@ -93,7 +93,7 @@ def check_http(app: metadata.App) -> tuple[Optional[str], Optional[int]]:
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    m = re.search(codeex, page)
 | 
					    m = re.search(codeex, page)
 | 
				
			||||||
    if not m:
 | 
					    if not m:
 | 
				
			||||||
        raise FDroidException("No RE match for version code")
 | 
					        raise FDroidException("No RE match for versionCode")
 | 
				
			||||||
    vercode = common.version_code_string_to_int(m.group(1).strip())
 | 
					    vercode = common.version_code_string_to_int(m.group(1).strip())
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if urlver != '.':
 | 
					    if urlver != '.':
 | 
				
			||||||
| 
						 | 
					@ -213,7 +213,7 @@ def check_tags(app: metadata.App, pattern: str) -> tuple[str, int, str]:
 | 
				
			||||||
            if codeex:
 | 
					            if codeex:
 | 
				
			||||||
                m = re.search(codeex, filecontent)
 | 
					                m = re.search(codeex, filecontent)
 | 
				
			||||||
                if not m:
 | 
					                if not m:
 | 
				
			||||||
                    logging.debug(f"UpdateCheckData regex {codeex} for version code"
 | 
					                    logging.debug(f"UpdateCheckData regex {codeex} for versionCode"
 | 
				
			||||||
                                  f" has no match in tag {tag}")
 | 
					                                  f" has no match in tag {tag}")
 | 
				
			||||||
                    continue
 | 
					                    continue
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -1098,7 +1098,7 @@ def get_metadata_files(vercodes):
 | 
				
			||||||
    Parameters
 | 
					    Parameters
 | 
				
			||||||
    ----------
 | 
					    ----------
 | 
				
			||||||
    vercodes
 | 
					    vercodes
 | 
				
			||||||
        version codes as returned by read_pkg_args()
 | 
					        versionCodes as returned by read_pkg_args()
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Returns
 | 
					    Returns
 | 
				
			||||||
    -------
 | 
					    -------
 | 
				
			||||||
| 
						 | 
					@ -2295,7 +2295,7 @@ def parse_androidmanifests(paths, app):
 | 
				
			||||||
                      .format(package, version, vercode))
 | 
					                      .format(package, version, vercode))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Always grab the package name and version name in case they are not
 | 
					        # Always grab the package name and version name in case they are not
 | 
				
			||||||
        # together with the highest version code
 | 
					        # together with the highest versionCode
 | 
				
			||||||
        if max_package is None and package is not None:
 | 
					        if max_package is None and package is not None:
 | 
				
			||||||
            max_package = package
 | 
					            max_package = package
 | 
				
			||||||
        if max_version is None and version is not None:
 | 
					        if max_version is None and version is not None:
 | 
				
			||||||
| 
						 | 
					@ -2608,7 +2608,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
 | 
				
			||||||
    # Remove forced debuggable flags
 | 
					    # Remove forced debuggable flags
 | 
				
			||||||
    remove_debuggable_flags(root_dir)
 | 
					    remove_debuggable_flags(root_dir)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    # Insert version code and number into the manifest if necessary
 | 
					    # Insert versionCode and number into the manifest if necessary
 | 
				
			||||||
    if build.forceversion:
 | 
					    if build.forceversion:
 | 
				
			||||||
        logging.info("Changing the version name")
 | 
					        logging.info("Changing the version name")
 | 
				
			||||||
        for path in manifest_paths(root_dir, flavors):
 | 
					        for path in manifest_paths(root_dir, flavors):
 | 
				
			||||||
| 
						 | 
					@ -2624,7 +2624,7 @@ def prepare_source(vcs, app, build, build_dir, srclib_dir, extlib_dir, onserver=
 | 
				
			||||||
                            path)
 | 
					                            path)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    if build.forcevercode:
 | 
					    if build.forcevercode:
 | 
				
			||||||
        logging.info("Changing the version code")
 | 
					        logging.info("Changing the versionCode")
 | 
				
			||||||
        for path in manifest_paths(root_dir, flavors):
 | 
					        for path in manifest_paths(root_dir, flavors):
 | 
				
			||||||
            if not path.is_file():
 | 
					            if not path.is_file():
 | 
				
			||||||
                continue
 | 
					                continue
 | 
				
			||||||
| 
						 | 
					@ -2949,7 +2949,7 @@ def get_apk_id(apkfile):
 | 
				
			||||||
    Returns
 | 
					    Returns
 | 
				
			||||||
    -------
 | 
					    -------
 | 
				
			||||||
    appid
 | 
					    appid
 | 
				
			||||||
    version code
 | 
					    versionCode
 | 
				
			||||||
    version name
 | 
					    version name
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
| 
						 | 
					@ -3564,7 +3564,7 @@ def metadata_find_signing_files(appid, vercode):
 | 
				
			||||||
    appid
 | 
					    appid
 | 
				
			||||||
        app id string
 | 
					        app id string
 | 
				
			||||||
    vercode
 | 
					    vercode
 | 
				
			||||||
        app version code
 | 
					        app versionCode
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Returns
 | 
					    Returns
 | 
				
			||||||
    -------
 | 
					    -------
 | 
				
			||||||
| 
						 | 
					@ -4426,7 +4426,7 @@ def string_is_integer(string):
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def version_code_string_to_int(vercode):
 | 
					def version_code_string_to_int(vercode):
 | 
				
			||||||
    """Convert an version code string of any base into an int."""
 | 
					    """Convert an versionCode string of any base into an int."""
 | 
				
			||||||
    # TODO: Python 3.6 allows underscores in numeric literals
 | 
					    # TODO: Python 3.6 allows underscores in numeric literals
 | 
				
			||||||
    vercode = vercode.replace('_', '')
 | 
					    vercode = vercode.replace('_', '')
 | 
				
			||||||
    try:
 | 
					    try:
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -354,7 +354,7 @@ def main():
 | 
				
			||||||
        if not versionName:
 | 
					        if not versionName:
 | 
				
			||||||
            logging.warning(_('Could not find latest version name'))
 | 
					            logging.warning(_('Could not find latest version name'))
 | 
				
			||||||
        if not versionCode:
 | 
					        if not versionCode:
 | 
				
			||||||
            logging.warning(_('Could not find latest version code'))
 | 
					            logging.warning(_('Could not find latest versionCode'))
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
        raise FDroidException(_("No gradle project could be found. Specify --subdir?"))
 | 
					        raise FDroidException(_("No gradle project could be found. Specify --subdir?"))
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -372,7 +372,7 @@ def check_update_check_data_int(app):  # noqa: D403
 | 
				
			||||||
        # codeex can be empty as well
 | 
					        # codeex can be empty as well
 | 
				
			||||||
        if codeex and not versioncode_check_pattern.search(codeex):
 | 
					        if codeex and not versioncode_check_pattern.search(codeex):
 | 
				
			||||||
            yield _(
 | 
					            yield _(
 | 
				
			||||||
                f'UpdateCheckData must match the version code as integer (\\d or [0-9]): {codeex}'
 | 
					                f'UpdateCheckData must match the versionCode as integer (\\d or [0-9]): {codeex}'
 | 
				
			||||||
            )
 | 
					            )
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -511,7 +511,7 @@ def insert_obbs(repodir, apps, apks):
 | 
				
			||||||
            obbWarnDelete(f, _('OBB filename must start with "main." or "patch.":'))
 | 
					            obbWarnDelete(f, _('OBB filename must start with "main." or "patch.":'))
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
        if not re.match(r'^-?[0-9]+$', chunks[1]):
 | 
					        if not re.match(r'^-?[0-9]+$', chunks[1]):
 | 
				
			||||||
            obbWarnDelete(f, _('The OBB version code must come after "{name}.":')
 | 
					            obbWarnDelete(f, _('The OBB versionCode must come after "{name}.":')
 | 
				
			||||||
                          .format(name=chunks[0]))
 | 
					                          .format(name=chunks[0]))
 | 
				
			||||||
            continue
 | 
					            continue
 | 
				
			||||||
        versionCode = int(chunks[1])
 | 
					        versionCode = int(chunks[1])
 | 
				
			||||||
| 
						 | 
					@ -550,7 +550,7 @@ VERSION_STRING_RE = re.compile(r'^([0-9]+)\.([0-9]+)\.([0-9]+)$')
 | 
				
			||||||
 | 
					
 | 
				
			||||||
def version_string_to_int(version):
 | 
					def version_string_to_int(version):
 | 
				
			||||||
    """
 | 
					    """
 | 
				
			||||||
    Convert sermver version designation to version code.
 | 
					    Convert semantic version designation to versionCode.
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    Approximately convert a [Major].[Minor].[Patch] version string
 | 
					    Approximately convert a [Major].[Minor].[Patch] version string
 | 
				
			||||||
    consisting of numeric characters (0-9) and periods to a number. The
 | 
					    consisting of numeric characters (0-9) and periods to a number. The
 | 
				
			||||||
| 
						 | 
					@ -2322,7 +2322,7 @@ def archive_old_apks(apps, apks, archapks, repodir, archivedir, defaultkeepversi
 | 
				
			||||||
                        continue
 | 
					                        continue
 | 
				
			||||||
                apkList.append(apk)
 | 
					                apkList.append(apk)
 | 
				
			||||||
 | 
					
 | 
				
			||||||
        # Sort the apk list by version code. First is highest/newest.
 | 
					        # Sort the apk list by versionCode. First is highest/newest.
 | 
				
			||||||
        sorted_list = sorted(apkList, key=lambda apk: apk['versionCode'], reverse=True)
 | 
					        sorted_list = sorted(apkList, key=lambda apk: apk['versionCode'], reverse=True)
 | 
				
			||||||
        if currentVersionApk:
 | 
					        if currentVersionApk:
 | 
				
			||||||
            # Insert apk which corresponds to currentVersion at the front
 | 
					            # Insert apk which corresponds to currentVersion at the front
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue