Giter Club home page Giter Club logo

python-gflags's Introduction

python-gflags's People

Contributors

jamalsenouci avatar marineam avatar mgorny avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

python-gflags's Issues

Python 3

What steps will reproduce the problem?
1. Having abandoned Python 2.x

Please provide any additional information below.

It is a bit unclear to what degree this component supports Python 3.
It seems like there has been some attempts?

Original issue reported on code.google.com by [email protected] on 31 Mar 2015 at 7:58

gflags_unittest.py does not respect TMPDIR

The tests in gflags_unittest.py rely on a hardcoded path in /tmp. This raises 
sandbox violations when the build is performed in an isolated environment, and 
has a collision potential when running tests for multiple Python 
implementations in parallel.

The test should at least respect the TMPDIR environment variable. I'm attaching 
a patch which uses tempfile.mkdtemp() to obtain an unique temporary directory, 
respecting TMPDIR.

Original issue reported on code.google.com by [email protected] on 16 Dec 2012 at 4:06

Attachments:

Should DEFINE_boolean() allow "None" as the default value?

Currently, we can define a boolean flag with default value to None:

 FLAGS = gflags.FLAGS
 gflags.DEFINE_boolean("the_flag", None, "The flag.")

I'm not sure if this is expected or should it be allowed, since python-gflags 
project tries to mimic the C++ version of gflags as close as possible.  This is 
troublesome because user may be unaware that a boolean flag can fail both of 
the following assertions:

 assertTrue(FLAGS.the_flag)  # AssertionError: None is not True
 assertFalse(FLAGS.the_flag)  # AssertionError: None is not False

Original issue reported on code.google.com by [email protected] on 4 Apr 2012 at 8:04

broken link on front page to gflags.py

What steps will reproduce the problem?
1. Go to http://code.google.com/p/python-gflags/
2. Click on "gflags.py" here:
    Documentation is at the top of gflags.py.


3. you get a 40 4 at http://python-
gflags.googlecode.com/svn/trunk/python/gflags.py

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.

You probably want http://code.google.com/p/python-
gflags/source/browse/trunk/gflags.py


Original issue reported on code.google.com by david.spencerian on 18 Feb 2010 at 6:38

setup.py installs Python scripts as 'data' rather than 'scripts'

The setup.py script lists the Python script as a 'data file', alike:

      data_files=[("bin", ["gflags2man.py"])],

while it should be a 'script' instead:

      scripts=["gflags2man.py"],

Installing it a script will make sure that distutils correctly update the 
Python shebang and make the script executable.

I'm attaching a patch fixing setup.py.

Original issue reported on code.google.com by [email protected] on 16 Dec 2012 at 3:41

Attachments:

broken link on main gflags page

What steps will reproduce the problem?
1. visit http://code.google.com/p/python-gflags/
2. find the line "Documentation is at the top of gflags.py."
3. click on the 'gflags.py' link

What is the expected output? What do you see instead?

take me to the source of gflags.py

What version of the product are you using? On what operating system?

n/a

Please provide any additional information below.

it should link to 
http://code.google.com/p/python-gflags/source/browse/trunk/gflags.py

Original issue reported on code.google.com by [email protected] on 2 May 2010 at 10:54

  • Merged into: #2

Test suite doesn't pass

What steps will reproduce the problem?
1. Extract tarball.
2. Run unit tests (python gflags_unittest.py)

What is the expected output? What do you see instead?
The test suite should pass.

Instead, I get this:
Traceback (most recent call last):
  File "gflags_unittest.py", line 51, in <module>
    import test_module_baz as module_baz
ImportError: No module named test_module_baz

What version of the product are you using? On what operating system?
1.5.1 on Ubuntu 11.04

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 14 Jun 2011 at 12:03

python-gflags-2.0 test failures; py2.7, pypy

What steps will reproduce the problem?
1. Run testsuite under py2.7, pypy
2.
3.

What is the expected output? What do you see instead?
Pass.
Failures

What version of the product are you using? On what operating system?
python-gflags-2.0

Please provide any additional information below.

>>> Source compiled.
 * pypy1_9: running distutils-r1_run_phase python_test OR pypy2_0
.......F...F.
======================================================================
FAIL: testFlagHelpInXML_SpaceSeparatedList 
(__main__.WriteFlagHelpInXMLFormatTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gflags_helpxml_test.py", line 253, in testFlagHelpInXML_SpaceSeparatedList
    self._CheckFlagHelpInXML('dirs', 'tool', expected_output)
  File "gflags_helpxml_test.py", line 102, in _CheckFlagHelpInXML
    self.assertMultiLineEqual(sio.getvalue(), expected_output)
  File "/mnt/gen2/TmpDir/portage/dev-python/python-gflags-2.0/work/python-gflags-2.0/tests/gflags_googletest.py", line 104, in assertMultiLineEqual
    unittest.TestCase.assertMultiLineEqual(self, expected, actual)
AssertionError: " <flag>\n   <file>tool</file>\n   <name>dirs</name>\n   
<meaning>Directories to [truncated]... != " <flag>\n   <file>tool</file>\n   
<name>dirs</name>\n   <meaning>Directories to [truncated]...
   <flag>
     <file>tool</file>
     <name>dirs</name>
     <meaning>Directories to search.</meaning>
     <default>src libs bin</default>
     <current>['src', 'libs', 'bin']</current>
     <type>whitespace separated list of strings</type>
-    <list_separator>' '</list_separator>
     <list_separator>'\t'</list_separator>
     <list_separator>'\n'</list_separator>
-    <list_separator>'\r'</list_separator>
     <list_separator>'\x0b'</list_separator>
     <list_separator>'\x0c'</list_separator>
+    <list_separator>'\r'</list_separator>
+    <list_separator>' '</list_separator>
   </flag>


======================================================================
FAIL: testWriteHelpInXMLFormat (__main__.WriteHelpInXMLFormatTest)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "gflags_helpxml_test.py", line 527, in testWriteHelpInXMLFormat
    self.assertMultiLineEqual(actual_output, expected_output)
  File "/mnt/gen2/TmpDir/portage/dev-python/python-gflags-2.0/work/python-gflags-2.0/tests/gflags_googletest.py", line 104, in assertMultiLineEqual
    unittest.TestCase.assertMultiLineEqual(self, expected, actual)
AssertionError: '<?xml version="1.0"?>\n<AllFlags>\n  
<program>gflags_helpxml_test.py</program>\ [truncated]... != '<?xml 
version="1.0"?>\n<AllFlags>\n  <program>gflags_helpxml_test.py</program>\ 
[truncated]...
Diff is 5042 characters long. Set self.maxDiff to None to see it.

----------------------------------------------------------------------
Ran 13 tests in 0.041s

FAILED (failures=2)

dev-python/python-gflags $ PYTHON_TARGETS="python2_7" ebuild  
python-gflags-2.0.ebuild clean test

yields

>>> Source compiled.
 * python2_7: running distutils-r1_run_phase python_test
.............
----------------------------------------------------------------------
Ran 13 tests in 0.015s

OK
.........E......EEEWarning: Hit circular flagfile dependency: 
/mnt/gen2/TmpDir/portage/dev-python/python-gflags-2.0/temp/python2.7/gflags_unit
testuxxTfV/UnitTestFile3.tst
EEEEE..E.EEF.........
======================================================================

Log attached for py2.7

Original issue reported on code.google.com by [email protected] on 4 Jul 2013 at 2:26

Attachments:

DuplicateFlagError when module with gflags definition is reimported

A DuplicateFlagError is thrown when:
1) Module A imports the gflags module and defines gflags.
2) Module A imports B
3) Module B imports A

Example:

File main.py:
---------------------------------
#!/usr/bin/python2.6

import sys
import gflags
import dep   # error

FLAGS = gflags.FLAGS
gflags.DEFINE_boolean("example", True, "example_flag")

if __name__ == "__main__":
  FLAGS(sys.argv)
  print FLAGS.example

---------------------------------


File dep.py:
---------------------------------
#!/usr/bin/python2.6

import main
---------------------------------


Error output:
---------------------------------
Traceback (most recent call last):
  File "example\main.py", line 10, in <module>
    gflags.DEFINE_boolean("example", True, "example_flag")
  File "C:\gflags\python\gflags.py", line 2378, in DEFINE_boolean
    DEFINE_flag(BooleanFlag(name, default, help, **args), flag_values)
  File "C:\gflags\python\gflags.py", line 2190, in DEFINE_flag
    fv[flag.name] = flag
  File "C:\gflags\python\gflags.py", line 1040, in __setitem__
    raise DuplicateFlagError(name, self)
gflags.DuplicateFlagError: The flag 'example' is defined twice. First from 
main, Second from example\main.py

Original issue reported on code.google.com by [email protected] on 26 Mar 2012 at 7:11

python-gflags builds SONAMEs which conflict with google-gflags

What steps will reproduce the problem?
1. Build the software
2.
3.

What is the expected output? What do you see instead?
If any shared libraries are built, they don't have the same SONAMEs as the 
already existing ones.

What version of the product are you using? On what operating system?
python-gflags-1.3, Solaris 8

Please provide any additional information below.

library files for google-gflags:

maciej@build8s [build8s]:~/src/opencsw/pkg/python-gflags/trunk > grep lib 
../../google-gflags/trunk/work/solaris8-sparc/build-
global/CSWgflags.prototype-sparc 
s none /opt/csw/lib/libgflags.so=libgflags.so.0.0.0
s none /opt/csw/lib/libgflags.so.0=libgflags.so.0.0.0
f none /opt/csw/lib/libgflags.so.0.0.0 0755 root bin
s none /opt/csw/lib/libgflags_nothreads.so=libgflags_nothreads.so.0.0.0
s none /opt/csw/lib/libgflags_nothreads.so.0=libgflags_nothreads.so.0.0.0
f none /opt/csw/lib/libgflags_nothreads.so.0.0.0 0755 root bin
s none /opt/csw/lib/sparcv9/libgflags.so=libgflags.so.0.0.0
s none /opt/csw/lib/sparcv9/libgflags.so.0=libgflags.so.0.0.0
f none /opt/csw/lib/sparcv9/libgflags.so.0.0.0 0755 root bin
s none 
/opt/csw/lib/sparcv9/libgflags_nothreads.so=libgflags_nothreads.so.0.0.0
s none 
/opt/csw/lib/sparcv9/libgflags_nothreads.so.0=libgflags_nothreads.so.0.0.0
f none /opt/csw/lib/sparcv9/libgflags_nothreads.so.0.0.0 0755 root bin

The same for python-gflags:

maciej@build8s [build8s]:~/src/opencsw/pkg/python-gflags/trunk > grep lib 
work/solaris8-sparc/build-global/CSWpython-gflags.prototype-sparc 
f none /opt/csw/lib/libgflags.so.0.0.0 0755 root bin
s none /opt/csw/lib/libgflags.so.0=libgflags.so.0.0.0
s none /opt/csw/lib/libgflags.so=libgflags.so.0.0.0
f none /opt/csw/lib/libgflags_nothreads.so.0.0.0 0755 root bin
s none /opt/csw/lib/libgflags_nothreads.so.0=libgflags_nothreads.so.0.0.0
s none /opt/csw/lib/libgflags_nothreads.so=libgflags_nothreads.so.0.0.0

Both projects create files with the same names:

google-gflags:
/opt/csw/lib/libgflags.so.0

python-gflags:
/opt/csw/lib/libgflags.so.0

It's not possible to build packages with google-gflags and python-gflags, 
because of conflicting files.  Perhaps C++ code should be stripped off 
python-gflags and a dependency should be added?

Original issue reported on code.google.com by [email protected] on 20 Feb 2010 at 2:45

python <name of program> -- does not give error.

What steps will reproduce the problem?

In your example code :
EXAMPLE USAGE:


  FLAGS = gflags.FLAGS

  # Flag names are globally defined!  So in general, we need to be
  # careful to pick names that are unlikely to be used by other libraries.
  # If there is a conflict, we'll get an error at import time.
  gflags.DEFINE_string('name', 'Mr. President', 'your name')
  gflags.DEFINE_integer('age', None, 'your age in years', lower_bound=0)
  gflags.DEFINE_boolean('debug', False, 'produces debugging output')
  gflags.DEFINE_enum('gender', 'male', ['male', 'female'], 'your gender')

  def main(argv):
    try:
      argv = FLAGS(argv)  # parse flags
    except gflags.FlagsError, e:
      print '%s\\nUsage: %s ARGS\\n%s' % (e, sys.argv[0], FLAGS)
      sys.exit(1)
    if FLAGS.debug: print 'non-flag arguments:', argv
    print 'Happy Birthday', FLAGS.name
    if FLAGS.age is not None:
      print 'You are a %d year old %s' % (FLAGS.age, FLAGS.gender)

  if __name__ == '__main__':
    main(sys.argv)

-------------------------------------------------------
[admin@gaudalvi-centos6 client]$ python temp.py --
Happy Birthday Mr. President

This should be error.

What is the expected output? What do you see instead?
Happy Birthday Mr. President

What version of the product are you using? On what operating system?
Cent OS 6.6
Python 2.6.6

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 18 Feb 2015 at 10:51

Test for permission errors fails as root

When running unit tests as root (i.e. as part of a install process that runs as 
root) one test fails because root can still read files with 0 for permissions. 
Attached is a pretty trivial way to skip the test that is compatible with any 
version of python. A fancier way in >= 2.7 would be to call self.skipTest().

Original issue reported on code.google.com by [email protected] on 28 Jun 2013 at 6:37

Attachments:

Need a way to ignore all undefined flags

Currently, when gflags module sees an unrecognized flag, it throws an exception 
and give up processing.  Even if we catch the exception and ignore it, we end 
up with a half baked flag registry.

The option "undefok" does part of the work, but it works only on specifically 
whitelisted flags.  It would be great to have an option to have it ignore ALL 
unrecognized flags.

Original issue reported on code.google.com by [email protected] on 22 Mar 2012 at 5:29

unicode not supported in help strings

What steps will reproduce the problem?
1. Define a flag with a non-ascii character in the help string.
2. Run ./your_app --help
3. *BOOM*

What is the expected output? What do you see instead?

I was hoping to see my string in the help output, instead ./app --help gave me 
this:
Traceback (most recent call last):
  File "foo.py", line 8, in <module>
    FLAGS(sys.argv)
  File "/home/soren/gflagstest/gflags.py", line 1188, in __call__
    flag.Parse(arg)
  File "/home/soren/gflagstest/gflags.py", line 2249, in Parse
    flags = str(FLAGS)
UnicodeEncodeError: 'ascii' codec can't encode characters in position 158-160: 
ordinal not in range(128)

What version of the product are you using? On what operating system?
SVN trunk (r16), Ubuntu Natty (python 2.7.1


Please provide any additional information below.
I'm attaching a script to reproduce.

Original issue reported on code.google.com by [email protected] on 14 Mar 2011 at 10:21

Attachments:

Add the label 'Google' for consistency w/ other Google contributions

What steps will reproduce the problem?
1.
2.
3.

What is the expected output? What do you see instead?


What version of the product are you using? On what operating system?


Please provide any additional information below.


Original issue reported on code.google.com by david.spencerian on 18 Feb 2010 at 6:49

Getting this installed on pipi and other ecosystem benefits

Is there any interest in getting this so it can be installed via 
pip/easy_install? Possibly adding support for tox?

Actually this is a patch for the latter (it has a problem with pypy though - 
sort order seems different?):

diff --git a/.gitignore b/.gitignore
new file mode 100644
index 0000000..0ac728b
--- /dev/null
+++ b/.gitignore
@@ -0,0 +1,3 @@
+*.pyc
+.tox/
+python_gflags.egg-info/
diff --git a/tox.ini b/tox.ini
new file mode 100644
index 0000000..b51f490
--- /dev/null
+++ b/tox.ini
@@ -0,0 +1,9 @@
+[tox]
+envlist=py26,py27,pypy
+
+[testenv]
+commands=
+  python tests/gflags_googletest.py
+  python tests/gflags_helpxml_test.py
+  python tests/gflags_unittest.py
+  python tests/gflags_validators_test.py

Original issue reported on code.google.com by [email protected] on 12 Nov 2012 at 8:19

There doesn't seem to be any option in setup.py to install to a directory other than /usr/local

What steps will reproduce the problem?
1. Issue 'python ./setup.py install as a non-root user
2. It fails and displays a message suggesting the use of --prefix or --
install-dir.
3. However, using --prefix or --install-dir goes unrecognized by setup.py.

What is the expected output? What do you see instead?

I expect an option that permits me to install python gflags at a different 
location than the default.

What version of the product are you using? On what operating system?

1.3. Ubuntu 9.10.

Please provide any additional information below.


Original issue reported on code.google.com by [email protected] on 11 Jan 2010 at 6:10

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.