Skip to content

Commit

Permalink
ver0.2.2
Browse files Browse the repository at this point in the history
  • Loading branch information
rahulrajpl committed Jan 20, 2020
1 parent 80d2448 commit 7498c14
Show file tree
Hide file tree
Showing 68 changed files with 7,128 additions and 2 deletions.
Binary file added __pycache__/netizenship.cpython-37.pyc
Binary file not shown.
28 changes: 28 additions & 0 deletions check_version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# credits: https://stackoverflow.com/users/2650249/hoefling

import json
import urllib.request
import sys

try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

from distutils.version import LooseVersion


def latest_version():
name = sys.argv[1]
installed_version = LooseVersion(version(name))

# fetch package metadata from PyPI
pypi_url = f'https://pypi.org/pypi/{name}/json'
response = urllib.request.urlopen(pypi_url).read().decode()
latest_version = max(LooseVersion(s) for s in json.loads(response)['releases'].keys())

# print('package:', name, 'installed:', installed_version, 'latest:', latest_version)\
return installed_version==latest_version

if not latest_version():
print('Do you want to update to latest version?')
Binary file added dist/netizenship-0.2.0-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.2.0.tar.gz
Binary file not shown.
Binary file added dist/netizenship-0.2.1-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.2.1.tar.gz
Binary file not shown.
Binary file added dist/netizenship-0.2.2-py3-none-any.whl
Binary file not shown.
Binary file added dist/netizenship-0.2.2.tar.gz
Binary file not shown.
29 changes: 28 additions & 1 deletion netizenship.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,30 @@
from bs4 import BeautifulSoup
from multiprocessing.pool import ThreadPool
from pyfiglet import figlet_format

import json
import urllib.request
import sys

try:
from importlib.metadata import version
except ImportError:
from importlib_metadata import version

from distutils.version import LooseVersion

def check_latest_version():
name = 'netizenship'
installed_version = LooseVersion(version(name))

# fetch package metadata from PyPI
pypi_url = f'https://pypi.org/pypi/{name}/json'
response = urllib.request.urlopen(pypi_url).read().decode()
latest_version = max(LooseVersion(s) for s in json.loads(response)['releases'].keys())
print(f'Current version: {installed_version}')

if not installed_version==latest_version:
print(f'Version {latest_version} available. To continue using the tool by running sudo pip3 install --upgrade netizenship')
exit()

def main():
def banner(text, ch='=', length=78):
Expand All @@ -27,6 +50,10 @@ def banner(text, ch='=', length=78):

ascii_banner = figlet_format('Netizenship')
print(ascii_banner)

# Check the version status.
check_latest_version()

banner_text = "MIT License, Copyright (c) 2020 Rahul Raj"
banner(banner_text)

Expand Down
5 changes: 4 additions & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
[tool.poetry]
name = "netizenship"
version = "0.1.9"
version = "0.2.2"
description = "Tool to check the username with popular websites for membership"
authors = ["Rahul Raj <[email protected]>"]
readme = "README.md"
homepage = "https://github.com/rahulrajpl/netizenship"
documentation = "https://github.com/rahulrajpl/netizenship/blob/master/README.md"

[tool.poetry.dependencies]
python = "^3.7"
Expand Down
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
pip
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
Copyright 2017-2019 Jason R. Coombs, Barry Warsaw

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at

http://www.apache.org/licenses/LICENSE-2.0

Unless required by applicable law or agreed to in writing, software
distributed under the License is distributed on an "AS IS" BASIS,
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
See the License for the specific language governing permissions and
limitations under the License.
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
Metadata-Version: 2.1
Name: importlib-metadata
Version: 1.4.0
Summary: Read metadata from Python packages
Home-page: http://importlib-metadata.readthedocs.io/
Author: Barry Warsaw
Author-email: [email protected]
License: Apache Software License
Platform: UNKNOWN
Classifier: Development Status :: 3 - Alpha
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: Apache Software License
Classifier: Topic :: Software Development :: Libraries
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 2
Requires-Python: !=3.0.*,!=3.1.*,!=3.2.*,!=3.3.*,!=3.4.*,>=2.7
Requires-Dist: zipp (>=0.5)
Requires-Dist: pathlib2 ; python_version < "3"
Requires-Dist: contextlib2 ; python_version < "3"
Requires-Dist: configparser (>=3.5) ; python_version < "3"
Provides-Extra: docs
Requires-Dist: sphinx ; extra == 'docs'
Requires-Dist: rst.linker ; extra == 'docs'
Provides-Extra: testing
Requires-Dist: packaging ; extra == 'testing'
Requires-Dist: importlib-resources ; (python_version < "3.7") and extra == 'testing'

=========================
``importlib_metadata``
=========================

``importlib_metadata`` is a library to access the metadata for a Python
package. It is intended to be ported to Python 3.8.


Usage
=====

See the `online documentation <https://importlib_metadata.readthedocs.io/>`_
for usage details.

`Finder authors
<https://docs.python.org/3/reference/import.html#finders-and-loaders>`_ can
also add support for custom package installers. See the above documentation
for details.


Caveats
=======

This project primarily supports third-party packages installed by PyPA
tools (or other conforming packages). It does not support:

- Packages in the stdlib.
- Packages installed without metadata.

Project details
===============

* Project home: https://gitlab.com/python-devs/importlib_metadata
* Report bugs at: https://gitlab.com/python-devs/importlib_metadata/issues
* Code hosting: https://gitlab.com/python-devs/importlib_metadata.git
* Documentation: http://importlib_metadata.readthedocs.io/


Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
importlib_metadata-1.4.0.dist-info/INSTALLER,sha256=zuuue4knoyJ-UwPPXg8fezS7VCrXJQrAP7zeNuwvFQg,4
importlib_metadata-1.4.0.dist-info/LICENSE,sha256=wNe6dAchmJ1VvVB8D9oTc-gHHadCuaSBAev36sYEM6U,571
importlib_metadata-1.4.0.dist-info/METADATA,sha256=ab04Ma9j7mLVkkTX4N0rP8imRjIEXo0V4soOFyxxNaQ,2093
importlib_metadata-1.4.0.dist-info/RECORD,,
importlib_metadata-1.4.0.dist-info/WHEEL,sha256=8zNYZbwQSXoB9IfXOjPfeNwvAsALAjffgk27FqvCWbo,110
importlib_metadata-1.4.0.dist-info/top_level.txt,sha256=CO3fD9yylANiXkrMo4qHLV_mqXL2sC5JFKgt1yWAT-A,19
importlib_metadata/__init__.py,sha256=B7TAxzEiiISp6EEz8pfPrny1z88CnZ--d-q2WWEjbPI,18025
importlib_metadata/__pycache__/__init__.cpython-37.pyc,,
importlib_metadata/__pycache__/_compat.cpython-37.pyc,,
importlib_metadata/_compat.py,sha256=1hcKW_koTLS0lFQt0Mwk8t34oUhHaBoyq6sCzL25vJU,3866
importlib_metadata/docs/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
importlib_metadata/docs/__pycache__/__init__.cpython-37.pyc,,
importlib_metadata/docs/__pycache__/conf.cpython-37.pyc,,
importlib_metadata/docs/changelog.rst,sha256=Qwtd-g3HVlimUlPKrWgp2mOHvJRjC617sbV_uEQD5bw,7366
importlib_metadata/docs/conf.py,sha256=m-b6Mju5gFkpSHh-lyJ4iwqf_8t4LjYYFRumtutQSZc,5578
importlib_metadata/docs/index.rst,sha256=rbXrDkLAKLIDccqME5u9CCMEfMKprqzQOkIOuwOnfz4,1907
importlib_metadata/docs/using.rst,sha256=tlh7M8y0hIRB0cYIflhVFQtdQSfm-Q4GE1luXCU4lIY,9286
importlib_metadata/tests/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
importlib_metadata/tests/__pycache__/__init__.cpython-37.pyc,,
importlib_metadata/tests/__pycache__/fixtures.cpython-37.pyc,,
importlib_metadata/tests/__pycache__/test_api.cpython-37.pyc,,
importlib_metadata/tests/__pycache__/test_integration.cpython-37.pyc,,
importlib_metadata/tests/__pycache__/test_main.cpython-37.pyc,,
importlib_metadata/tests/__pycache__/test_zip.cpython-37.pyc,,
importlib_metadata/tests/data/__init__.py,sha256=47DEQpj8HBSa-_TImW-5JCeuQeRkm5NMpJWZG3hSuFU,0
importlib_metadata/tests/data/__pycache__/__init__.cpython-37.pyc,,
importlib_metadata/tests/data/example-21.12-py3-none-any.whl,sha256=I-kYufETid-tDYyR8f1OFJ3t5u_Io23k0cbQxJTUN4I,1455
importlib_metadata/tests/data/example-21.12-py3.6.egg,sha256=-EeugFAijkdUO9xyQHTZkQwZoFXK0_QxICBj6R5AAJo,1497
importlib_metadata/tests/fixtures.py,sha256=sshuoJ4ezljeouUddVg-76K1UOStKWBecovZOKOBguk,5004
importlib_metadata/tests/test_api.py,sha256=YMAGTsRENrtvpw2CSLmRndJMBeT4q_M0GSe-QsnnMZ4,5544
importlib_metadata/tests/test_integration.py,sha256=kzqav9qAePjz7UR-GNna65xLwXlRcxEDYDwmuOFwpKE,686
importlib_metadata/tests/test_main.py,sha256=nnKTmcIA14lhynepCfXtiTYWH35hNFuFfIcKBkzShuY,7179
importlib_metadata/tests/test_zip.py,sha256=qG3IquiTFLSrUtpxEJblqiUtgEcOTfjU2yM35REk0fo,2372
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Wheel-Version: 1.0
Generator: bdist_wheel (0.33.6)
Root-Is-Purelib: true
Tag: py2-none-any
Tag: py3-none-any

Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
importlib_metadata
Loading

0 comments on commit 7498c14

Please sign in to comment.