diff --git a/MANIFEST.in b/MANIFEST.in index fded9d6..93e6caa 100644 --- a/MANIFEST.in +++ b/MANIFEST.in @@ -8,4 +8,4 @@ recursive-include tests * recursive-exclude * __pycache__ recursive-exclude * *.py[co] -recursive-include docs *.rst conf.py Makefile make.bat stdlib +recursive-include docs *.rst conf.py Makefile make.bat stdlib mapping diff --git a/pipreqs/mapping b/pipreqs/mapping new file mode 100644 index 0000000..b54967d --- /dev/null +++ b/pipreqs/mapping @@ -0,0 +1,102 @@ +Testing:Zope2 +uwsgidecorators:uWSGI +OpenGL:PyOpenGL +zmq:pyzmq +TreeDisplay:DocumentTemplate +Signals:Zope2 +chef:PyChef +odf:odfpy +enum:enum34 +bpdb:bpython +ctff:tff +dogshell:dogapi +S3:s3cmd +fdpexpect:pexpect +gabbi:tiddlyweb +pybloomfilter:pybloomfiltermmap +ZTUtils:Zope2 +dns:dnspython +ZServer:Zope2 +example:adrest +requests:Requests +faker:Faker +greplin:scales +couchdb:CouchDB +OpenSSL:pyOpenSSL +shapefile:pyshp +s2repoze:pysaml2 +pyximport:Cython +encutils:cssutils +yaml:PyYAML +funtests:librabbitmq +reStructuredText:Zope2 +sqlalchemy:SQLAlchemy +rosdep2:rosdep +em:empy +HelpSys:Zope2 +bson:pymongo +wsmeext:WSME +pysideuic:PySide +jwt:PyJWT +cups:pycups +validate:configobj +hgext:mercurial +libfuturize:future +scss:pyScss +sx:pisa +MethodObject:ExtensionClass +ZPublisher:Zope2 +bs4:beautifulsoup4 +flvscreen:vnc2flv +pylab:matplotlib +colors:ansicolors +wikklytext:tiddlywebwiki +pwiz:peewee +fabfile:Fabric +xdg:pyxdg +OFS:Zope2 +Products:Zope2 +playhouse:peewee +qs:qserve +xmlenc:pysaml2 +enchant:pyenchant +libgenerateDS:generateDS +screen:pexpect +solr:solrpy +portalocker:ConcurrentLogHandler +robot:robotframework +stubout:mox +pxssh:pexpect +pilot:BigJob +ANSI:pexpect +demo:webunit +gridfs:pymongo +App:Zope2 +fuse:fusepy +BeautifulSoupTests:BeautifulSoup +coordination:BigJob +Globals:Zope2 +PIL:Pillow +hamcrest:PyHamcrest +FSM:pexpect +cloghandler:ConcurrentLogHandler +google:protobuf +examples:tweepy +xmldsig:pysaml2 +Crypto:pycrypto +paste:PasteScript +usb:pyusb +QtCore:PySide +ComputedAttribute:ExtensionClass +Shared:Zope2 +webdav:Zope2 +emlib:empy +git:GitPython +ho:pisa +atom:gdata +github:PyGithub +curl:pycurl +saml2:pysaml2 +depot:filedepot +concurrent:futures +serial:pyserial \ No newline at end of file diff --git a/pipreqs/pipreqs.py b/pipreqs/pipreqs.py index ac71a18..4778c13 100755 --- a/pipreqs/pipreqs.py +++ b/pipreqs/pipreqs.py @@ -62,7 +62,7 @@ def get_all_imports(start_path): 'Found third-party packages: {0}'.format(third_party_packages)) with open(os.path.join(os.path.dirname(__file__), "stdlib"), "r") as f: data = [x.strip() for x in f.readlines()] - return sorted(list(set(third_party_packages) - set(data))) + return get_pkg_names_from_import_names(sorted(list(set(third_party_packages) - set(data)))) def generate_requirements_file(path, imports): @@ -115,6 +115,19 @@ def get_import_local(imports): result.append(local[item]) return result +def get_pkg_names_from_import_names(pkgs): + result = [] + with open(os.path.join(os.path.dirname(__file__), "mapping"), "r") as f: + data = [x.strip().split(":") for x in f.readlines()] + for pkg in pkgs: + toappend = pkg + for item in data: + if item[0] == pkg: + toappend = item[1] + break + result.append(toappend) + return result + def init(args): print("Looking for imports") diff --git a/setup.py b/setup.py index b76bfa6..34dd79e 100755 --- a/setup.py +++ b/setup.py @@ -36,7 +36,7 @@ setup( package_dir={'pipreqs': 'pipreqs'}, include_package_data=True, - package_data={'': ['stdlib']}, + package_data={'': ['stdlib','mapping']}, install_requires=requirements, license="Apache License", zip_safe=False,