Start of unified 'openbazaar [options] <command>' python based launcher script.

 - added pystun as a pip requirement
 - Gets external IP (UDP: port) using STUN servers.
 - Checks if DYLD_LIBRARY_PATH has been set on MacOSX, if not
   gives a warning and tries to ammend by manually loading
   libssl.dylib and libcrypto.dylib if found at `brew --prefix openssl`.
 - default configuration values loaded into a dictionary that will
   be used on the rest of the launching script.
 - OpenBazaar is launched and P2P port used is dynamic and based on the port reported as available via STUN.
   however, I'll try to use multiprocessing so that the code runs on a separate process
   and we can return control back to the user on the terminal's process.

 STILL TO BE DONE:
   - implementing shutdown websocket or http handler, and being able to send a websocket request.
   - implementing a status websocket or http handler to print the status of the servent

Important refactors, introducing OpenBazaarContext to carry runtime configuration options. [WIP - still very unstable]

  - ioloop.install() redundancy cleanup, only installed once on openbazaar_daemon.

  - refactored ioloop's instantiation and startup out of openbazaar_daemon.start_node()
     as a new method 'start_ioloop()', invoked at the beginning of start_node() inside its
     own daemon thread.

  - New OpenBazaarContext object to hold all runtime configuration parameters and more
    runtime related information.

  - Argument parser now uses default values defined in getDefaults(),
    no need for repetition of these defaults, now can be maintained in a single place.

  - 'database' argument now parsed and used by OpenBazaarContext as 'db_path',
    this avoids confusion with a Obdb object. On the command line, users can still
    pass the --database parameter, irrelevant inside the codebase.

  - Periodic IP Checker for users trying to run on Tor now optional.
    Use runtime option '--enable-ip-checker' to enable periodic ip checking.

  - New parameter '--log-level' to change log verbosity.

  - Refactored signatures of MarketApplication.__init__, CryptoTransportLayer.__init,
    TransportLayer.__init__(), openbazaar_daemon.start_node(),

  - Removed code execution on openbazaar_daemon, argument parsing was redundant
    and this code will be (hopefully) unnecessary as we'll be getting rid of run.sh
    by the end of this feature branch.

  Had a chance to learn even more doing this, I may have some questions about the
  market_id when not specified. I couldn't find where it's generated @hoffmabc

start openbazaar_daemon in daemon thread, reuse defaults dictionary instance, pep8

trying to load libcrypto and libssl didn't work. When DYLD_LIBRARY_PATH is not set on osx, we'll just prompt help message and kill the process

Make sure database environments are setup correctly, including for development mode.

breakdown refactor on startup, OpenBazaarContext creation in its own method.

Updated transport tests, passing.

new --disable-stun-check option

Cleanup, new simplified "openbazaar" bash command

* Invoke node/openbazaar.py and gives back control to the user on the command
  line. Binaries for each platform will be necessary to invoke the python
  process that starts/stops OB.

Pure python launcher now equivalent to run.sh.

Just needs --config parameter to accept a configuration file on startup and I'll submit this
as a pull request to develop branch. pep8 compliant, all python tests pass.

Will also need to merge latest changes after this point, to make sure this will be easy to merge
with latest changes on master.

 - Supports development mode, launchers multiple instances, makes sure every instance has db setup. refactors.
 - configure.sh: make sure to use env/bin python tools, small refactor.
 - requirements.txt: fixed pystun requirement
 - openbazaar (posix CLI launcher) makes sure openssl library is in DYLD_LIBRARY_PATH if running on macosx.

 Fixes on transport.py:
 - commented out inet_pton calls. inet_pton wasn't actually
 doing anything except raise exceptions. in the event that
 inet_pton would actually work, its output was not being used
 to obtain the ip in raw network format anyways.
 - now when we shutdown transport, we make sure the zmq event
 stream is closed properly.
 - in case the market_id is different after we load the settings
 we make sure the OpenbazaarContext object knows is updated.
 - ipv4.icanhazip.com fix on periodic callback updater (fixed merged from master branch)

Search pylint from virtualenv bin.

Style fixes.

Dev nodes.

* Normalizing commit. The changes inside should be reverted.

Changes after first round of reviews.

 - removed sudo call when using ./env/bin/** on configure.sh
 - os.path.join
 - initArgumentParser renamed to createArgumentParser as it is a factory method.
 - defaults not passed as a method parameter, always generated from get_defaults to guarantee
   the map hasn't been tampered with (immutability ftw)
 - new util.is_mac() to check if we are on macosx. uses platform.uname() for better compatibility.
   didn't code is_linux() nor is_windows() as I don't have a computer to check on the actual values returned
   by platform.uname()
 - assert statement without parens
 - OpenBazaarContext subclasses from object.
 - """ for doc strings.
 - renamed camelCased methods to python_style_names.
 - start_io_loop now on the same thread, no need to make it on another thread and then join.
 - zmq io loop installation moved to openbazaar_daemon, no necessary at the launcher script.
 - bye bye run.sh

more fixes after comments.

 - got rid of all 'E501 line too long' warnings on openbazaar.py
 - made sure no defaults were missing when defining arguments
 - got rid of unused help messages.
 - added more examples on how to use the launcher in usage
Supports loading config flags from file, other suggested fixes.

- supports --config-file <file> option.
- cyrpto_util has no os specific code. Mac's DYLD_LIBRARY_PATH check moved to openbazaar_daemon.py
- suggested fixes on comments.
- fixes import issue on test_transport.py

Still to do:
 `$ openbazaar stop`
 `$ openbazaar status`
openbazaar stop [WIP]
run.sh and stop.sh no longer needed
Remove some redundant arguments.

* Bitmessage arguments still duplicate.
* Dropped web_xxx (only http used now)
* Flag settings cleanup and refactors.
Next round of refactors and fixes.

* Moved default context values inside OpenBazaarContext.get_defaults()
* New OpenBazaarContext.create_default_instance() used now on test_transport.py
* When shutting down we now have a mutex to make sure two SIGTERM and SIGKILL don't
  call the application.shutdown() routine at the same time.
* style fixes.
multiple refactors (encapsulation, readability, modularity, pep8)

* Should fix test breakage.
* Stopping from the Web UI was broken.
Use BitMessage together with the context.
Converge with #780.
Up the default log level to 30.
Merge pull request #782 from Renelvon/launcher

Full python launcher. Introducing STUN.
Remove constants "unit" tests.

Unit tests are meant to test logic, not declarations. This is why we
don't test our HTML and CSS code. Unit tests express contractual, behavioral
obligations of modules. Constants do not correspond to contracts.

This test needs to go, so I'm removing it.

It seems to me that here we're simply trying to increase the coverage
metric and this is hurting the quality of our tests. Let's keep in mind
that coverage is a measure that helps us improve, but the end goal is
better testing.

Testing that constants are equal to what they are is unnecessary
duplication and doesn't add any value to the tests. Furthermore, it
violates DRY, as every constant update must come with a test update.
This is true for all testing, but in this case the same thing is
expressed in the test and in the implementation and is not a form of
contractual obligation.

If you must, you can test that the constants exist and are of specified
types. Feel free to readd that in case you consider it a necessity.
Merge pull request #786 from dionyziz/remove_declaration_tests

Remove constants "unit" tests.
Stricten pylinting.

* Make pylint output color-coded to facilitate discerning errors
  from suppressed warnings.
* Warn on methods overriden by attributes (E0202).
* Warn if name is not in module (E0611).
* Warn if arguments differ in overriden method (W0221).
* Require __init__ in all classes (W0232).
* Disallow name shadowing (W0621). Redefining names from outer scopes hampers
  readability and may hide subtle errors, since python normally allows
  read-only access to global names.
* Require lazy logging (W1201). This should significantly lessen the string
  processing in nodes with quiet logging modes.
* Disallow long lines (C0301). Set the limit to 116 chars for now.
* Limit class ancestors to 7 (R0901); too much subclassing is bad design.
Suppress unreasonable pylint warnings.

* Suppress pylint error E0202 in BackupJSONEncoder. Usage is in agreement
  with the json package documentation.
* Suppress pylint error E0611 in behave and distutil imports. Usage is in
  agreement with the packages' documentation.
* Suppress pylint warning W0221 in node/ws.py. This is only a temporary hack
  and should be fixed in the future.
Cleanup DataStore class.

* Inherit from object and make it a new-style class.
* Drop unused DictDataStore and MongoDatastore.
* Insert a dummy DataStore.__init__ ; call it from subclass.
* Drop dead code from SqliteDataStore.
Fix shadowing of global names.

* Pack main inside a function so that its symbols don't pollute
  global namespace.
Remove pointless test files.
Install lazy logging. Drop some dead code.
Fix some long lines.

* Drop dead code that contains long lines.
* Use `.get` to simplify inline ifs.