FaradayRF / faradayio-cli

Command Line Interface implementation of the faradayio module
GNU General Public License v3.0
1 stars 1 forks source link

Implement Basic Project Structure #2

Closed kb1lqc closed 6 years ago

kb1lqc commented 6 years ago

setup a setup.py python file for the project

kb1lqc commented 6 years ago

Working from the help of this blog post:

kb1lqc commented 6 years ago

OK some progress when I import the main() using a command line entry script. It appears that I need to work out the requirements document 😄

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ python -m faradayio-cli arg1
Traceback (most recent call last):
  File "/usr/lib/python3.5/runpy.py", line 184, in _run_module_as_main
    "__main__", mod_spec)
  File "/usr/lib/python3.5/runpy.py", line 85, in _run_code
    exec(code, run_globals)
  File "/home/bryce/Documents/git/faradayio-cli/faradayio-cli/__main__.py", line 3, in <module>
    from .faradayio_cli import main
  File "/home/bryce/Documents/git/faradayio-cli/faradayio-cli/faradayio_cli.py", line 7, in <module>
    from faradayio.faraday import Faraday
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio/faraday.py", line 10, in <module>
    import sliplib
ImportError: No module named 'sliplib'
kb1lqc commented 6 years ago

Alright! Installing sliplib and python-pytun worked and allowed me to call the script from the command line!

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ python -m faradayio-cli arg1
Executing faradayio-cli version 0.0.0
kb1lqc commented 6 years ago

Per https://github.com/kb1lqc/faradayio-cli/commit/e3f8f3de73e5ed88acad268af6021f06bf7c3746 I have a basic installation that works:

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ python3 setup.py install
running install
running bdist_egg
running egg_info
writing dependency_links to faradayio_cli.egg-info/dependency_links.txt
writing faradayio_cli.egg-info/PKG-INFO
writing entry points to faradayio_cli.egg-info/entry_points.txt
writing top-level names to faradayio_cli.egg-info/top_level.txt
reading manifest file 'faradayio_cli.egg-info/SOURCES.txt'
writing manifest file 'faradayio_cli.egg-info/SOURCES.txt'
installing library code to build/bdist.linux-x86_64/egg
running install_lib
running build_py
creating build/bdist.linux-x86_64/egg
creating build/bdist.linux-x86_64/egg/faradayio_cli
copying build/lib/faradayio_cli/faradayio_cli.py -> build/bdist.linux-x86_64/egg/faradayio_cli
copying build/lib/faradayio_cli/__init__.py -> build/bdist.linux-x86_64/egg/faradayio_cli
copying build/lib/faradayio_cli/__main__.py -> build/bdist.linux-x86_64/egg/faradayio_cli
byte-compiling build/bdist.linux-x86_64/egg/faradayio_cli/faradayio_cli.py to faradayio_cli.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/faradayio_cli/__init__.py to __init__.cpython-35.pyc
byte-compiling build/bdist.linux-x86_64/egg/faradayio_cli/__main__.py to __main__.cpython-35.pyc
creating build/bdist.linux-x86_64/egg/EGG-INFO
copying faradayio_cli.egg-info/PKG-INFO -> build/bdist.linux-x86_64/egg/EGG-INFO
copying faradayio_cli.egg-info/SOURCES.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying faradayio_cli.egg-info/dependency_links.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying faradayio_cli.egg-info/entry_points.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
copying faradayio_cli.egg-info/top_level.txt -> build/bdist.linux-x86_64/egg/EGG-INFO
zip_safe flag not set; analyzing archive contents...
creating 'dist/faradayio_cli-0.0.0-py3.5.egg' and adding 'build/bdist.linux-x86_64/egg' to it
removing 'build/bdist.linux-x86_64/egg' (and everything under it)
Processing faradayio_cli-0.0.0-py3.5.egg
Copying faradayio_cli-0.0.0-py3.5.egg to /home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages
Adding faradayio-cli 0.0.0 to easy-install.pth file
Installing faradayio-cli script to /home/bryce/Documents/git/faradayio-cli/.venv/bin

Installed /home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/faradayio_cli-0.0.0-py3.5.egg
Processing dependencies for faradayio-cli==0.0.0
Finished processing dependencies for faradayio-cli==0.0.0
(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ 

Now when I run the command faradayio-cli the following output is generated:

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ faradayio-cli 
Executing faradayio-cli version 0.0.0
kb1lqc commented 6 years ago

It's important to note that somewhere faradayio is being run and it somehow "knows" about faradayio-cli which doesn't seem correct!

(.venv) bryce@bryce-ubuntu:~/Documents/git/faradayio-cli$ faradayio
Traceback (most recent call last):
  File "/home/bryce/Documents/git/faradayio-cli/.venv/bin/faradayio", line 11, in <module>
    load_entry_point('faradayio-cli==0.0.0', 'console_scripts', 'faradayio')()
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 572, in load_entry_point
    return get_distribution(dist).load_entry_point(group, name)
  File "/home/bryce/Documents/git/faradayio-cli/.venv/lib/python3.5/site-packages/pkg_resources/__init__.py", line 2754, in load_entry_point
    raise ImportError("Entry point %r not found" % ((group, name),))
ImportError: Entry point ('console_scripts', 'faradayio') not found
kb1lqc commented 6 years ago

I'm closing this issue for now. We will see if the faradayio console access issue pops up later. Not sure if it's just an artifact on my computer at the moment. Moving on!

kb1lqc commented 6 years ago

Opening up because I haven't actually merged it into the project yet.

kb1lqc commented 6 years ago

Closing per #5