Git Product home page Git Product logo

libbytesize's People

Contributors

a-detiste avatar aduskett avatar crayxt avatar dashea avatar dependabot[bot] avatar fitojb avatar giuliobenetti avatar gururajrkatti avatar hongxu-jia avatar japokorn avatar jibec avatar martinpitt avatar norwayfun avatar pothos avatar qnixsynapse avatar ricky-tigg avatar simmon-nplob avatar tbzatek avatar thesamesam avatar timb87 avatar triallax avatar vojtechtrefny avatar vpodzime avatar weblate avatar yarons avatar

Stargazers

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

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

libbytesize's Issues

Can `--privileged` option for `docker run` be removed for ppc64le

I am running the build and test as a part of the Ubuntu distribution for ppc64le.
This helps us simplify testing later when distributions are re-building and re-releasing.

During the build and test (DOCKER_FILE=".travis/Dockerfile.debian-testing"), I found that it makes use of --privileged for docker run.

It fails for ppc64le since privileged containers are not supported for lxd backend.
I also verified that without using this option, the travis build succeeds for ppc64le.

Wanted to check if it is okay to remove this option for ppc64le or is there any specific reason for including --privileged option.

Where is the NEWS or Changelog file?

You upgraded for version 0.11 to 1.0. What changed?

Note that the git changelog is not really satisfactory. It gives equal weight to a typo in a comment and major functionality changes.

Why not run 'make dist' before releasing a new tarball?

please migrate to the new Fedora translation platform

Hello, the Fedora project migrates its translation platform to Weblate [1].

This tool directly interact with your git repository, and requires us to know:

  • [mandatory] which branch is your development branch?
  • [mandatory] have you merged latest translation from Zanata and locked the project?
  • [info] Weblate will handle updates when pot file changes, don't edit po files for this [2]
  • [optional] what is the license of translation? (please use a code from https://spdx.org/licenses/)
  • [optional] do you have any announcement/warning you would like to display to the translators? (it will be displayed in Weblate)
  • [optional] do you need us to activate any specific checks? (this is a setting per component [3])
  • [optional] do you need us to automatically detect new translation files? (typical usecase: website translation with one translation file per page)

Please note:

  • For github hosted projects, Weblate open pull request. For other project, you'll have to add a key to allow commits.
  • In Weblate's vocable, one project is a group of component. Each component is a translation file. You can have many projects or many components or both.
  • You can change your mind over time, just reach [email protected]

[1] https://communityblog.fedoraproject.org/fedora-localization-platform-migrates-to-weblate/
[2] https://docs.weblate.org/en/latest/admin/continuous.html#avoiding-merge-conflicts
[3] https://docs.weblate.org/en/latest/user/checks.html#translation-checks

exec_prefix used before expanded

Hello!

Trying to build this project (on Debian) but running into issues when enabling the python3 bindings (python2 disabled so far):

The configure.ac references $exec_prefix in relation to the python bindings. The configure file generated in my build puts the code expanded from configure.ac related to $exec_prefix before it puts the code to expand exec_prefix from $prefix if exec_prefix is left at its default NONE value. I thus end up with python bindings being installed in NONE/lib/python3.*/.... rather than /usr/lib/python3.*/....

root@mbpah:/build/libbytesize-0.9# cat -n configure | grep -A 2 -B 2 PYTHON3_EXECDIR=
 13641	  PYTHON3_EXEC_PREFIX='${exec_prefix}'
 13642	
 13643	      PYTHON3_EXECDIR=`$python3 -c "import distutils.sysconfig; \
 13644	                                print(distutils.sysconfig.get_python_lib(1,0,prefix='${exec_prefix}'))"`
 13645	      py3execdir=$PYTHON3_EXECDIR

root@mbpah:/build/libbytesize-0.9# cat -n configure | grep -A 2 -B 2 'test.*exec_prefix.*NONE.*prefix'
 13824	test "x$prefix" = xNONE && prefix=$ac_default_prefix
 13825	# Let make expand exec_prefix.
 13826	test "x$exec_prefix" = xNONE && exec_prefix='${prefix}'
 13827	
 13828	# Transform confdefs.h into DEFS.

root@mbpah:/build/libbytesize-0.9# 

I was told the solution was to move the usage of $exec_prefix from configure to make phase, but don't see how to do that here.

libbytesize.so.1 does not link to PCRE2

Trying to run bscalc on Void Linux (which packages libbytesize 2.7, though I can reproduce the issue when I bump the package to 2.8 locally), I get this error:

Traceback (most recent call last):
  File "/bin/bscalc", line 6, in <module>
    from bytesize import Size, ZeroDivisionError
  File "/usr/lib/python3.11/site-packages/bytesize/__init__.py", line 1, in <module>
    from .bytesize import Size
  File "/usr/lib/python3.11/site-packages/bytesize/bytesize.py", line 23, in <module>
    c_bytesize = ctypes.CDLL("libbytesize.so.1")
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/lib/python3.11/ctypes/__init__.py", line 376, in __init__
    self._handle = _dlopen(self._name, mode)
                   ^^^^^^^^^^^^^^^^^^^^^^^^^
OSError: /usr/lib/libbytesize.so.1: undefined symbol: pcre2_substring_get_byname_8

Here's the output of ldd /usr/lib/libbytesize.so.1:

        linux-vdso.so.1 (0x00007ffe39931000)
        libmpfr.so.6 => /usr/lib/libmpfr.so.6 (0x00007f27d3ded000)
        libgmp.so.10 => /usr/lib/libgmp.so.10 (0x00007f27d3d70000)
        libc.so.6 => /usr/lib/libc.so.6 (0x00007f27d3b87000)
        /usr/lib64/ld-linux-x86-64.so.2 (0x00007f27d3ebb000)

So for some reason, libbytesize.so.1 is not linking to libpcre2-8.so.0. I asked on the Void Linux support channels about this, and was told that I should report this issue to libbytesize. Any idea how to fix this?

AttributeError: 'NoneType' object has no attribute 'bs_size_free'

I'm seeing bunch of these messages at the end of the blivet examples on rawhide (2.1-devel, 2.2-devel):

Exception ignored in: <object repr() failed>
Traceback (most recent call last):
  File "/usr/lib64/python3.5/site-packages/bytesize/bytesize.py", line 100, in __del__
AttributeError: 'NoneType' object has no attribute 'bs_size_free'

Some unit tests fail if locales are not available

Hi,

running the libbytesize unit tests on my system results in the following error:

Traceback (most recent call last):
  File "./libbytesize_unittest.py", line 346, in testHumanReadable
    locale.setlocale(locale.LC_ALL, 'cs_CZ.UTF-8')
  File "/usr/lib64/python3.5/locale.py", line 594, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

because I only have the following locales on my system:

# locale -a
C
POSIX
de_DE
de_DE.iso88591
de_DE.iso885915@euro
de_DE.utf8
de_DE@euro
deutsch
en_US
en_US.iso88591
en_US.utf8
german

I suggest to run tests that require specific locales only if the required locaes are really available.

Size calculation does not work correctly on i686 due to integer type issues

Quoting from this bugzilla comment by Stefan Ring:

"The bug is in libbytesize's Python binding:

>>> import bytesize.bytesize
>>> bytesize.bytesize.Size(0) + 2**36
Size (0 B)

Well, actually it's in the C part of libbytesize, because for example bs_size_add_bytes (responsible for the error shown above) takes a uint64_t, which it happily passes on to mpz_add_ui, which takes an unsigned long, and thus truncation happens.

A workaround would be replacing every occurrence of MAXUINT64 in bytesize.py with sys.maxsize. Of course, it would be better fixing the C interface, which would probably take a bit more work. Although, it would mostly consist of replacing uint64_t with unsigned long."

Python 2 switch

Hi there! Would be to much work to create a switch to disable python 2 support?

[packit] Propose downstream failed for release 2.8

Packit failed on creating pull-requests in dist-git (https://src.fedoraproject.org/rpms/libbytesize.git):

dist-git branch error
f36 See https://dashboard.packit.dev/results/propose-downstream/2014
f37 See https://dashboard.packit.dev/results/propose-downstream/2012
f38 See https://dashboard.packit.dev/results/propose-downstream/2013
rawhide See https://dashboard.packit.dev/results/propose-downstream/2011

You can retrigger the update by adding a comment (/packit propose-downstream) into this issue.

Python path detection doesn't work on Debian

Somehow this change broke the Debian build.

               libbytesize 2.7
             ====================

        prefix:                     /usr
        libdir:                     ${prefix}/lib/x86_64-linux-gnu
        libexecdir:                 ${exec_prefix}/libexec
        bindir:                     ${exec_prefix}/bin
        sbindir:                    ${exec_prefix}/sbin
        datadir:                    ${datarootdir}
        sysconfdir:                 /etc
        localstatedir:              /var
        docdir:                     ${datarootdir}/doc/${PACKAGE_TARNAME}

        compiler:                   gcc
        cflags:                     -g -O2 -ffile-prefix-map=/home/michael/debian/build-area/libbytesize-2.7=. -fstack-protector-strong -Wformat -Werror=format-security -DENABLE_NLS
        cppflags:                   -Wdate-time -D_FORTIFY_SOURCE=2
        ldflags:                    -Wl,-z,relro -Wl,-z,now

        Python 3 bindings:          yes
        tools:                      no
...

 /bin/mkdir -p '/home/michael/debian/build-area/libbytesize-2.7/debian/tmp/usr/local/lib/python3.10/dist-packages/bytesize'
 /usr/bin/install -c -m 644 bytesize.py __init__.py '/home/michael/debian/build-area/libbytesize-2.7/debian/tmp/usr/local/lib/python3.10/dist-packages/bytesize'

Notice how it installs the files in /usr/local despite using --prefix=/usr

Reverting this commit, I get:

<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
<string>:1: DeprecationWarning: The distutils package is deprecated and slated for removal in Python 3.12. Use setuptools or check PEP 632 for potential alternatives
<string>:1: DeprecationWarning: The distutils.sysconfig module is deprecated, use sysconfig instead
 /bin/mkdir -p '/home/michael/debian/build-area/libbytesize-2.7/debian/tmp/usr/lib/python3/dist-packages/bytesize'
 /usr/bin/install -c -m 644 bytesize.py __init__.py '/home/michael/debian/build-area/libbytesize-2.7/debian/tmp/usr/lib/python3/dist-packages/bytesize'

A few warnings but installed into the proper path

Originally posted by @mbiebl in #98 (comment)

libbytesize_unittest.py:locale.Error: unsupported locale setting

When executing test suite, it displayed the following error message.
ERROR: testSubBytes (main.SizeTestCase)

Traceback (most recent call last):
File "/home/abuild/rpmbuild/BUILD/libbytesize-2.6/tests/locale_utils.py", line 26, in decorated
return test_method(test, *args)
File "/home/abuild/rpmbuild/BUILD/libbytesize-2.6/tests/./libbytesize_unittest.py", line 31, in setUp
locale.setlocale(locale.LC_ALL, DEFAULT_LOCALE)
File "/usr/lib64/python3.9/locale.py", line 610, in setlocale
return _setlocale(category, locale)
locale.Error: unsupported locale setting

It seems that python3.9 doesn't recognize "en_US.utf8".
DEFAULT_LOCALE should use "en_US.UTF-8" in tests/libbytesize_unittest.py
-DEFAULT_LOCALE = "en_US.utf8"
+DEFAULT_LOCALE = "en_US.UTF-8"

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.