Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use the combined ArgparseConfigParser from openmicroscopy/yaclifw#5 #47

Closed
wants to merge 8 commits into from

Conversation

manics
Copy link
Member

@manics manics commented Jul 3, 2014

See ome/yaclifw#5
Essentially most arguments on the command line can also be specified in a config file (command line takes precedence).

Other changes:

  • I've completely removed the parsing of environment variables (EnvDefault)
  • Default branch changed from OMERO-trunk to OMERO-5.0-latest (omego defaults to ICE=3.5 if a label isn't given)

omego-test.cfg:

#omego configuration file
[main]
branch = OMERO-5.0-latest
verbose = 1

# Note configuration sections are named after a subcommand
# so for example settings in [db] will only apply to omego db,
# and not subcommand which use the same options such as
# `omego upgrade`. Instead they should go in [main]
dbhost = localhost
dbname = omero-test
dbuser = omero
dbpass = omero

[download]
# Uses the default branch from above
skipunzip = True

[install]
branch = OMERO-5.0-merge-build
sym = OMERO-50-test
initdb = True

[upgrade]
branch = OMERO-5.0-merge-build
sym = OMERO-50-test
upgradedb = True

For example you should be able to do
omego download -c omego-test.cfg cpp
equivalent to passing --branch OMERO-5.0-latest --skipunzip

omego upgrade -c omego-test.cfg
equivalent to passing --branch OMERO-5.0-merge-build --sym OMERO-50-test --upgradedb --db...

Note that omego install doesn't actually work so don't bother trying it

When testing also be aware that I haven't fixed up the args, so there are some flags that aren't really flags (they require a true/false string arg).

@manics
Copy link
Member Author

manics commented Jul 3, 2014

--depends-on ome/yaclifw#5

Obviously Travis fails because this requires the updated yaclifw

@pwalczysko
Copy link
Member

I think I have checked out successfully the yaclifw PR and upgraded yaclifw using sudo pip install -U yaclifw.
The I tried to execute following (after checking out this PR):

[petr@ls25165 ~/Work/omero5-server]$ ~/Work/omero-setup/omego/main.py download -c omego-test.cfg cpp
ArgparseConfigParser.add_argument_group ('positional arguments',) {}
ArgparseConfigParser.add_argument_group ('optional arguments',) {}
ArgparseConfigParser.add_argument ('-h', '--help') {'action': 'help', 'default': '==SUPPRESS==', 'help': 'show this help message and exit'} True
ArgparseConfigParser.add_argument_group ('positional arguments',) {}
ArgparseConfigParser.add_argument_group ('optional arguments',) {}
ArgparseConfigParser.add_argument ('-c', '--conffile') {'default': [], 'action': 'append', 'metavar': 'FILE.cfg', 'help': 'Configuration file (can be repeated)'} True
Traceback (most recent call last):
  File "/Users/petr/Work/omero-setup/omego/main.py", line 60, in <module>
    entry_point()
  File "/Users/petr/Work/omero-setup/omego/main.py", line 50, in entry_point
    parse_config_files=['-c', '--conffile'])
  File "/Users/petr/Work/omero-setup/omego/framework.py", line 190, in main
    omego_parser, sub_parsers, parents = parsers(parse_config_files)
  File "/Users/petr/Work/omero-setup/omego/framework.py", line 165, in parsers
    *parse_config_files, config_section='main', add_help=False)
  File "/Users/petr/Work/omero-setup/omego/argparseconfig.py", line 225, in add_and_parse_config_files
    'Failed to read configuration file(s): %s' % ' '.join(unread))
Exception: Failed to read configuration file(s): omego-test.cfg
[petr@ls25165 ~/Work/omero5-server]$ 

@joshmoore
Copy link
Member

Travis is red as well.

@manics
Copy link
Member Author

manics commented Jul 8, 2014

Looks like there's some extra print statements in there, I'll hunt them down.

Exception: Failed to read configuration file(s): omego-test.cfg

@pwalczysko Did you create a configuration file?

@joshmoore Travis fails because this needs a merge version of yaclifw

@manics
Copy link
Member Author

manics commented Jul 8, 2014

@pwalczysko Are you sure you've got the whole yaclifw PR checked out and installed? in your yaclifw checkout can you run
git log -1
and try runningomego using
PYTHONPATH=~/path/to/yaclifw ~/Work/omero-setup/omego/main.py .....

@pwalczysko
Copy link
Member

Sorted this out with @manics . All seems to work fine now.

@manics
Copy link
Member Author

manics commented Jan 25, 2016

See #76 instead

@manics manics closed this Jan 25, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants