{ "info": { "author": "Tim Savannah", "author_email": "kata198@gmail.com", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "License :: Public Domain", "Programming Language :: Python", "Programming Language :: Python :: 2", "Programming Language :: Python :: 2.6", "Programming Language :: Python :: 2.7", "Programming Language :: Python :: 3", "Programming Language :: Python :: 3.3", "Programming Language :: Python :: 3.4", "Programming Language :: Python :: 3.5", "Programming Language :: Python :: 3.6", "Topic :: Software Development :: Libraries :: Python Modules", "Topic :: Software Development :: Version Control" ], "description": "cmp\\_version\n============\n\nA script and python module to compare version numbers. Use this to compare the version strings of packages, modules, really anything.\n\nSince version 3.0, cmp\\_version supports all kinds of complex version numbers, including those with releases ( like $version-5 ) or Epochs (like 5:$version)\n\n\nCommandline Tool\n----------------\n\nYou can use the provided *cmp-version* tool to compare two version strings. \n\nIt will print to stdout \"-1\" if version1 is less/older than version2, \"0\" if they are equal, and \"1\" if version1 is greater/newer than version2.\n\n\nExamples:\n\n\t$ ./cmp\\-version 1.0.1b 1.0.1a\n\n\t1\n\n\t$ ./cmp\\-version 1.0.1b 1.0.2\n\n\t\\-1\n\n\t$ ./cmp\\-version 1.0 1.0.0\n\n\t0\n\n\nComparing Filenames\n-------------------\n\nWithout actually scanning the contents of a package, you can from a script compare the versions based on the filenames.\n\nExample:\n\n\t$ cmp\\-version glibc\\-6.2.1\\-3.x86\\_64.rpm glibc\\-6.2.3\\-1.x86\\_64.rpm\n\n\t\\-1\n\n\n\nMethod Signature\n----------------\n\nThe cmp\\_version module provides a single method, *cmp\\_version* which compares two versions \"cmp\" style (think strcmp or the \"cmp\" operator in python<3).\n\n\t\n\tdef cmp\\_version(version1, version2):\n\n\t\t'''\n\n\t\t\tcmp\\_version \\- Compare two version strings, checking which one represents a \"newer\" (greater) release.\n\n\t\t\tNote that even if two version strings are not equal string\\-wise, they may still be equal version\\-wise (e.x. 1.0.0 is the same version as 1.0)\n\n\t\t\t@param version1 \\- A version string\n\n\t\t\t@param version2 \\- A version string\n\n\t\t\t@return \n\n\t\t\t\t\\-1 if version1 is older/less than version2\n\n\t\t\t\t0 if version1 is equal to version2\n\n\t\t\t\t1 if version1 is newer/greater than version2\n\n\t\t\tSo for example,\n\n\t\t\t\tcmp\\_version('1.0.5b', '1.0.5a') would return 1 because 1.0.5b comes after 1.0.5a\n\n\nSpecial Type\n------------\n\ncmp\\_version provides a special type, \"VersionString\", which inherits string. All the comparison magic functions are implemented, such that you can directly compare VersionString objects.\n\nExample:\n\n\t>>> x = VersionString('0.1b2')\n\n\t>>> y = VersionString('.2b2')\n\n\t>>>\n\n\t>>> '0.1b2' < '.2b2' # Show that as strings this version compare gives wrong answer\n\n\tFalse\n\n\t>>> x < y # Show that using VersionString objects, the comparison does work\n\n\tTrue\n\n\n\nSorting Lists\n-------------\n\nYou can sort a list of versions, or filenames containing versions etc like this:\n\n\t>>> from cmp\\_version import cmp\\_version, VersionString\n\n\t>>>\n\n\t>>> x = ['.9a', '0.9', '0.9.0', '1.2c', '1.1b', '1.b4.0']\n\n\t>>> sorted(x, key=VersionString)\n\n\t['0.9', '0.9.0', '.9a', '1.1b', '1.2c', '1.b4.0']\n\n\t\n\n\nReturn value\n------------\n\n* 0 is returned when the two versions are equal, even if the strings are not equal (for example \"1.0\" is the same version as \"1.0.0\")\n\n* -1 is returned when version1 is older/less than version2\n\n* 1 is returned when version1 is newer/greater than version2.\n\n\nLicense\n-------\n\nThis module is released under Public Domain.", "description_content_type": "", "docs_url": "https://pythonhosted.org/cmp_version/", "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "https://github.com/kata198/cmp_version", "keywords": "cmp,version,cmp_version,compare,version,number,package,rpm,commandline,tool,module,release", "license": "Public Domain", "maintainer": "Tim Savannah", "maintainer_email": "kata198@gmail.com", "name": "cmp_version", "package_url": "https://pypi.org/project/cmp_version/", "platform": "", "project_url": "https://pypi.org/project/cmp_version/", "project_urls": { "Homepage": "https://github.com/kata198/cmp_version" }, "release_url": "https://pypi.org/project/cmp_version/3.0.0/", "requires_dist": null, "requires_python": "", "summary": "A script and python module to compare version numbers. Use this to compare the version strings of packages, modules, really anything.", "version": "3.0.0" }, "last_serial": 3775216, "releases": { "1.0.0": [ { "comment_text": "", "digests": { "md5": "bf1554bf0e69ce68b86313ace6ee04b8", "sha256": "0636ed90c11c3811239888a0da209669fea55b7aea9d40ddda0b8f0a13fa930d" }, "downloads": -1, "filename": "cmp_version-1.0.0.tar.gz", "has_sig": false, "md5_digest": "bf1554bf0e69ce68b86313ace6ee04b8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3438, "upload_time": "2016-03-22T20:52:39", "url": "https://files.pythonhosted.org/packages/7d/2b/031847a600186856b620423dc648ebaa8398159ae569f84d2b8c14c35924/cmp_version-1.0.0.tar.gz" } ], "1.0.1": [ { "comment_text": "", "digests": { "md5": "752b2661e8adb772928649df5b800adf", "sha256": "82f1cc41f2760e8d83ce3128682264918853c81ef41775acdd3ae45e72840733" }, "downloads": -1, "filename": "cmp_version-1.0.1.tar.gz", "has_sig": false, "md5_digest": "752b2661e8adb772928649df5b800adf", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3616, "upload_time": "2016-03-22T20:58:17", "url": "https://files.pythonhosted.org/packages/c1/c6/6cb1336bffc174ff758e18e54f62dcf79da870789810620d6b0728005e06/cmp_version-1.0.1.tar.gz" } ], "1.0.2": [ { "comment_text": "", "digests": { "md5": "7a5daa28ad46c2c6d2d8930606de5140", "sha256": "e426d027a1b603355af7da5a04a3445f79cc91310b609620391daf47c12ccb08" }, "downloads": -1, "filename": "cmp_version-1.0.2.tar.gz", "has_sig": false, "md5_digest": "7a5daa28ad46c2c6d2d8930606de5140", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 3769, "upload_time": "2016-03-22T21:05:23", "url": "https://files.pythonhosted.org/packages/8a/00/961079f7a453e908b055d37d9a448497698d2892f23d8266262508a44af0/cmp_version-1.0.2.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "13229630fe7f4f531ebd69b390f73b12", "sha256": "528c9e55c1deb837c8f6abf5b0d3ebdc98d74cbd3ff5dfdc5c9dfe8cad599ff6" }, "downloads": -1, "filename": "cmp_version-2.0.0.tar.gz", "has_sig": false, "md5_digest": "13229630fe7f4f531ebd69b390f73b12", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4519, "upload_time": "2016-03-23T17:56:41", "url": "https://files.pythonhosted.org/packages/b8/fd/46695d22eb99ff467741b9c01b8f5222a0a9df9dffc36546e8f6d50ccdae/cmp_version-2.0.0.tar.gz" } ], "2.1.1": [ { "comment_text": "", "digests": { "md5": "a121de230f6cc606da6724cd5f9ed287", "sha256": "b6d78db9bf7281a5c528b61cc2c395aa96ec038c9a192aa0546d677ac6038ea4" }, "downloads": -1, "filename": "cmp_version-2.1.1.tar.gz", "has_sig": false, "md5_digest": "a121de230f6cc606da6724cd5f9ed287", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 14523, "upload_time": "2017-06-04T09:06:08", "url": "https://files.pythonhosted.org/packages/30/4c/b1b297bfcbd3403d66e396b626971e3f403e43a4cef5900886c1ab682bb5/cmp_version-2.1.1.tar.gz" } ], "3.0.0": [ { "comment_text": "", "digests": { "md5": "ae83b413c31e78398eaad17b69938af2", "sha256": "3a61ff0052f514f9f5d427034b7be8d0eac30d9884aed4bb28f0a14bdaef8f0f" }, "downloads": -1, "filename": "cmp_version-3.0.0.tar.gz", "has_sig": false, "md5_digest": "ae83b413c31e78398eaad17b69938af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20522, "upload_time": "2018-04-18T00:42:37", "url": "https://files.pythonhosted.org/packages/61/d2/b79dc36a234554319cb1c346340eaaa162101bfe808ce9d68cf02bb4d7f1/cmp_version-3.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "ae83b413c31e78398eaad17b69938af2", "sha256": "3a61ff0052f514f9f5d427034b7be8d0eac30d9884aed4bb28f0a14bdaef8f0f" }, "downloads": -1, "filename": "cmp_version-3.0.0.tar.gz", "has_sig": false, "md5_digest": "ae83b413c31e78398eaad17b69938af2", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 20522, "upload_time": "2018-04-18T00:42:37", "url": "https://files.pythonhosted.org/packages/61/d2/b79dc36a234554319cb1c346340eaaa162101bfe808ce9d68cf02bb4d7f1/cmp_version-3.0.0.tar.gz" } ] }