python-dependency-injector icon indicating copy to clipboard operation
python-dependency-injector copied to clipboard

Create own debian package with version 3.44.0 of python-dependency-injector

Open maxlavr opened this issue 3 years ago • 8 comments

Hello everyone, my name is Max and my profession is DevOps. Our company are working with some software that requires python-dependency-injector as a dependency. We need to build this dependency from source and use the package because it is a security requirement. But I haven't find any debian repo with instructions and directory "debian" in https://salsa.debian.org/public or in this repository. I have built project myself, but when I install him I have some errors:

Настраивается пакет python-dependency-injector (3.44.0-1) …
  File "/usr/lib/python2.7/dist-packages/dependency_injector/ext/aiohttp.py", line 34
    async def _view(request, *args, **kwargs):
        ^
SyntaxError: invalid syntax

  File "/usr/lib/python2.7/dist-packages/dependency_injector/types.py", line 17
    def __call__(self, *args: Injection, **kwargs: Injection) -> T: ...
                            ^
SyntaxError: invalid syntax

dpkg: ошибка при обработке пакета python-dependency-injector (--install):

Maybe you can help fix this error or give me your debian.orig.tar with 3.44.0 version ?

maxlavr avatar Mar 12 '21 16:03 maxlavr

Hi @maxlavr ,

Version 3.44.0 contains some Python 3 files. Seems like the installation fails when you install on Python 2. That's sort of unexpected because Python 3 files should not be used in that case.

I would love to help fixing that. I'll try to build debian package and get back to you.

rmk135 avatar Mar 12 '21 21:03 rmk135

Thank you @rmk135 !!! I will wait you and also I have more additional information for you! I forked your repository and pushed my own debian instructions in debian/3.44.0 branch. Maybe they will help you.

But I have observed strange behavior. My debhelper configured to build package with --buildsystem=pybuild. All python instructions pass in this line to dh $@ Also I pass python version to build the package: --with python3. I have built a debian package with these configurations and installed it without any errors! If you change from --with python3 to --with python2, the package is also built, but it installs with the errors mentioned above

So can you also answer what correct build system of python2 and python3 choose for debhelper. I doubt the right choice of python3...

PS. How I build package For build package from my forked repository you should install (debhelper version 9)

sudo apt-get install -y lintian debhelper cdbs devscripts build-essential

Go to directory with source code from my branch and build package with command

debuild -uc -us

maxlavr avatar Mar 13 '21 19:03 maxlavr

@maxlavr I'm a bit overwhelmed with other project, will get back in a day or two.

rmk135 avatar Mar 15 '21 20:03 rmk135

@maxlavr ,

I've played a little with your branch. I was able to build a package and install it on Python 2:

root@19debb68ceaa:/# dpkg -i python-dependency-injector_3.44.0-1_amd64.deb
(Reading database ... 33261 files and directories currently installed.)
Preparing to unpack python-dependency-injector_3.44.0-1_amd64.deb ...
Unpacking python-dependency-injector (3.44.0-1) over (3.44.0-1) ...
Setting up python-dependency-injector (3.44.0-1) ...
  File "/usr/lib/python2.7/dist-packages/dependency_injector/ext/aiohttp.py", line 42
    async def _view(request, *args, **kwargs):
        ^
SyntaxError: invalid syntax

  File "/usr/lib/python2.7/dist-packages/dependency_injector/resources.py", line 11
    ...
    ^
SyntaxError: invalid syntax

  File "/usr/lib/python2.7/dist-packages/dependency_injector/wiring.py", line 31
    ...
    ^
SyntaxError: invalid syntax

dpkg: error processing package python-dependency-injector (--install):
 installed python-dependency-injector package post-installation script subprocess returned error exit status 101
Errors were encountered while processing:
 python-dependency-injector
root@19debb68ceaa:/# cd code/
root@19debb68ceaa:/code# debuild -uc -us
 dpkg-buildpackage -us -uc -ui
dpkg-buildpackage: info: source package python-dependency-injector
dpkg-buildpackage: info: source version 3.44.0-1
dpkg-buildpackage: info: source distribution unstable
dpkg-buildpackage: info: source changed by maxlavr <[email protected]>
 dpkg-source --before-build .
dpkg-buildpackage: info: host architecture amd64
 debian/rules clean
dh clean --with python3 --buildsystem=pybuild
   dh_auto_clean -O--buildsystem=pybuild
I: pybuild base:217: python2.7 setup.py clean
running clean
removing '/code/.pybuild/cpython2_2.7/build' (and everything under it)
'build/bdist.linux-amd64' does not exist -- can't clean it
'build/scripts-2.7' does not exist -- can't clean it
   dh_clean -O--buildsystem=pybuild
 dpkg-source -b .
dpkg-source: warning: no source format specified in debian/source/format, see dpkg-source(1)
dpkg-source: warning: source directory 'code' is not <sourcepackage>-<upstreamversion> 'python-dependency-injector-3.44.0'
dpkg-source: warning: .orig directory name code.orig is not <package>-<upstreamversion> (wanted python-dependency-injector-3.44.0.orig)
dpkg-source: info: using source format '1.0'
dpkg-source: info: building python-dependency-injector using existing python-dependency-injector_3.44.0.orig.tar.gz
dpkg-source: info: building python-dependency-injector in python-dependency-injector_3.44.0-1.diff.gz
dpkg-source: warning: ignoring deletion of file debian/python-dependency-injector.debhelper.log
dpkg-source: warning: ignoring deletion of file debian/python-dependency-injector.substvars
dpkg-source: warning: ignoring deletion of directory build
dpkg-source: warning: ignoring deletion of directory build/temp.linux-amd64-2.7
dpkg-source: warning: ignoring deletion of directory build/temp.linux-amd64-2.7/src
dpkg-source: warning: ignoring deletion of directory build/temp.linux-amd64-2.7/src/dependency_injector
dpkg-source: warning: ignoring deletion of file build/temp.linux-amd64-2.7/src/dependency_injector/providers.o
dpkg-source: warning: ignoring deletion of file build/temp.linux-amd64-2.7/src/dependency_injector/containers.o
dpkg-source: info: building python-dependency-injector in python-dependency-injector_3.44.0-1.dsc
 debian/rules build
dh build --with python3 --buildsystem=pybuild
   dh_update_autotools_config -O--buildsystem=pybuild
   dh_auto_configure -O--buildsystem=pybuild
I: pybuild base:217: python2.7 setup.py config
running config
   dh_auto_build -O--buildsystem=pybuild
I: pybuild base:217: /usr/bin/python setup.py build
running build
running build_py
creating /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/__init__.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/errors.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/resources.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/wiring.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector
creating /code/.pybuild/cpython2_2.7/build/dependency_injector/ext
copying src/dependency_injector/ext/__init__.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector/ext
copying src/dependency_injector/ext/aiohttp.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector/ext
copying src/dependency_injector/ext/flask.py -> /code/.pybuild/cpython2_2.7/build/dependency_injector/ext
copying src/dependency_injector/containers.pxd -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/providers.pxd -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/__init__.pyi -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/containers.pyi -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/providers.pyi -> /code/.pybuild/cpython2_2.7/build/dependency_injector
copying src/dependency_injector/py.typed -> /code/.pybuild/cpython2_2.7/build/dependency_injector
running build_ext
building 'dependency_injector.containers' extension
creating build
creating build/temp.linux-amd64-2.7
creating build/temp.linux-amd64-2.7/src
creating build/temp.linux-amd64-2.7/src/dependency_injector
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -fdebug-prefix-map=/code=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/python2.7 -c src/dependency_injector/containers.c -o build/temp.linux-amd64-2.7/src/dependency_injector/containers.o -O2
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -g -O2 -fdebug-prefix-map=/code=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-amd64-2.7/src/dependency_injector/containers.o -o /code/.pybuild/cpython2_2.7/build/dependency_injector/containers.so
building 'dependency_injector.providers' extension
x86_64-linux-gnu-gcc -pthread -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -fno-strict-aliasing -g -O2 -fdebug-prefix-map=/code=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 -fPIC -DCYTHON_CLINE_IN_TRACEBACK=0 -I/usr/include/python2.7 -c src/dependency_injector/providers.c -o build/temp.linux-amd64-2.7/src/dependency_injector/providers.o -O2
x86_64-linux-gnu-gcc -pthread -shared -Wl,-O1 -Wl,-Bsymbolic-functions -Wl,-z,relro -fno-strict-aliasing -DNDEBUG -g -fwrapv -O2 -Wall -Wstrict-prototypes -Wdate-time -D_FORTIFY_SOURCE=2 -g -fdebug-prefix-map=/build/python2.7-2.7.16=. -fstack-protector-strong -Wformat -Werror=format-security -Wl,-z,relro -g -O2 -fdebug-prefix-map=/code=. -fstack-protector-strong -Wformat -Werror=format-security -Wdate-time -D_FORTIFY_SOURCE=2 build/temp.linux-amd64-2.7/src/dependency_injector/providers.o -o /code/.pybuild/cpython2_2.7/build/dependency_injector/providers.so
   dh_auto_test -O--buildsystem=pybuild
I: pybuild base:217: cd /code/.pybuild/cpython2_2.7/build; python2.7 -m unittest discover -v

----------------------------------------------------------------------
Ran 0 tests in 0.000s

OK
 debian/rules binary
dh binary --with python3 --buildsystem=pybuild
   dh_testroot -O--buildsystem=pybuild
   dh_prep -O--buildsystem=pybuild
   dh_auto_install -O--buildsystem=pybuild
I: pybuild base:217: /usr/bin/python setup.py install --root /code/debian/python-dependency-injector
running install
running build
running build_py
running build_ext
running install_lib
creating /code/debian/python-dependency-injector/usr
creating /code/debian/python-dependency-injector/usr/lib
creating /code/debian/python-dependency-injector/usr/lib/python2.7
creating /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages
creating /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/__init__.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/__init__.pyi -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/containers.pxd -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/containers.pyi -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/containers.so -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/errors.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
creating /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/ext/__init__.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/ext/aiohttp.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/ext/flask.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/providers.pxd -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/providers.pyi -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/providers.so -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/py.typed -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/resources.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
copying /code/.pybuild/cpython2_2.7/build/dependency_injector/wiring.py -> /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector
byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/__init__.py to __init__.pyc
byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/errors.py to errors.pyc
byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext/__init__.py to __init__.pyc
byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext/aiohttp.py to aiohttp.pyc
  File "/usr/lib/python2.7/dist-packages/dependency_injector/ext/aiohttp.py", line 42
    async def _view(request, *args, **kwargs):
        ^
SyntaxError: invalid syntax

byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext/flask.py to flask.pyc
byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/resources.py to resources.pyc
  File "/usr/lib/python2.7/dist-packages/dependency_injector/resources.py", line 11
    ...
    ^
SyntaxError: invalid syntax

byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/wiring.py to wiring.pyc
  File "/usr/lib/python2.7/dist-packages/dependency_injector/wiring.py", line 31
    ...
    ^
SyntaxError: invalid syntax

running install_egg_info
running egg_info
writing requirements to src/dependency_injector.egg-info/requires.txt
writing src/dependency_injector.egg-info/PKG-INFO
writing top-level names to src/dependency_injector.egg-info/top_level.txt
writing dependency_links to src/dependency_injector.egg-info/dependency_links.txt
reading manifest file 'src/dependency_injector.egg-info/SOURCES.txt'
reading manifest template 'MANIFEST.in'
warning: no files found matching 'py.typed'
writing manifest file 'src/dependency_injector.egg-info/SOURCES.txt'
Copying src/dependency_injector.egg-info to /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector-4.29.2.egg-info
Skipping SOURCES.txt
running install_scripts
   dh_installdocs -O--buildsystem=pybuild
   dh_installchangelogs -O--buildsystem=pybuild
   dh_python3 -O--buildsystem=pybuild
E: dh_python3 dh_python3:176: no package to act on (python3-foo or one with ${python3:Depends} in Depends)
   dh_installinit -O--buildsystem=pybuild
   dh_perl -O--buildsystem=pybuild
   dh_link -O--buildsystem=pybuild
   dh_strip_nondeterminism -O--buildsystem=pybuild
   dh_compress -O--buildsystem=pybuild
   dh_fixperms -O--buildsystem=pybuild
   dh_missing -O--buildsystem=pybuild
   dh_strip -O--buildsystem=pybuild
   dh_makeshlibs -O--buildsystem=pybuild
   dh_shlibdeps -O--buildsystem=pybuild
dpkg-shlibdeps: warning: package could avoid a useless dependency if debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/containers.so debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/providers.so were not linked against libpthread.so.0 (they use none of the library's symbols)
   dh_installdeb -O--buildsystem=pybuild
   dh_gencontrol -O--buildsystem=pybuild
dpkg-gencontrol: warning: package python-dependency-injector: substitution variable ${shlibs:Depends} unused, but is defined
dpkg-gencontrol: warning: package python-dependency-injector: substitution variable ${shlibs:Depends} unused, but is defined
   dh_md5sums -O--buildsystem=pybuild
   dh_builddeb -O--buildsystem=pybuild
dpkg-deb: building package 'python-dependency-injector' in '../python-dependency-injector_3.44.0-1_amd64.deb'.
dpkg-deb: building package 'python-dependency-injector-dbgsym' in '../python-dependency-injector-dbgsym_3.44.0-1_amd64.deb'.
 dpkg-genbuildinfo
 dpkg-genchanges  >../python-dependency-injector_3.44.0-1_amd64.changes
dpkg-genchanges: info: including full source code in upload
 dpkg-source --after-build .
dpkg-buildpackage: info: full upload (original source is included)
Now running lintian python-dependency-injector_3.44.0-1_amd64.changes ...
warning: the authors of lintian do not recommend running it with root privileges!
W: python-dependency-injector source: package-depends-on-hardcoded-libc python-dependency-injector depends
E: python-dependency-injector source: source-is-missing build/temp.linux-amd64-2.7/src/dependency_injector/containers.o
E: python-dependency-injector source: source-is-missing build/temp.linux-amd64-2.7/src/dependency_injector/providers.o
W: python-dependency-injector source: package-file-is-executable debian/changelog
W: python-dependency-injector source: package-file-is-executable debian/control
W: python-dependency-injector source: dh-make-template-in-source debian/menu.ex
W: python-dependency-injector source: dh-make-template-in-source debian/postinst.ex
W: python-dependency-injector source: dh-make-template-in-source debian/postrm.ex
W: python-dependency-injector source: dh-make-template-in-source debian/preinst.ex
W: python-dependency-injector source: dh-make-template-in-source debian/prerm.ex
E: python-dependency-injector source: executable-debhelper-file-without-being-executable debian/python-dependency-injector-dev.dirs
E: python-dependency-injector source: executable-debhelper-file-without-being-executable debian/python-dependency-injector-dev.install
E: python-dependency-injector source: executable-debhelper-file-without-being-executable debian/python-dependency-injector-docs.docs
W: python-dependency-injector source: dh-make-template-in-source debian/python-dependency-injector.cron.d.ex
E: python-dependency-injector source: temporary-debhelper-file python-dependency-injector.debhelper.log
W: python-dependency-injector source: dh-make-template-in-source debian/python-dependency-injector.default.ex
W: python-dependency-injector source: dh-make-template-in-source debian/python-dependency-injector.doc-base.EX
E: python-dependency-injector source: executable-debhelper-file-without-being-executable debian/python-dependency-injector1.dirs
E: python-dependency-injector source: executable-debhelper-file-without-being-executable debian/python-dependency-injector1.install
W: python-dependency-injector source: dh-make-template-in-source debian/shlibs.local.ex
W: python-dependency-injector source: dh-make-template-in-source debian/watch.ex
E: python-dependency-injector source: missing-build-dependency-for-dh-addon python3 => python3:any | python3-all:any | python3-dev:any | python3-all-dev:any | dh-sequence-python3
W: python-dependency-injector source: missing-debian-source-format
W: python-dependency-injector source: changelog-should-mention-nmu
W: python-dependency-injector source: source-nmu-has-incorrect-version-number 3.44.0-1
W: python-dependency-injector source: python-foo-but-no-python3-foo python-dependency-injector
E: python-dependency-injector source: debian-rules-is-dh_make-template
W: python-dependency-injector source: no-debian-copyright
E: python-dependency-injector source: invalid-standards-version 3.44.0
W: python-dependency-injector: wrong-bug-number-in-closes l3:#nnnn
W: python-dependency-injector: new-package-should-close-itp-bug
E: python-dependency-injector: changelog-is-dh_make-template
E: python-dependency-injector: no-copyright-file
E: python-dependency-injector: description-starts-with-package-name
E: python-dependency-injector: description-too-short python-dependency-injector
E: python-dependency-injector: description-is-pkg-name python-dependency-injector
E: python-dependency-injector: extended-description-is-empty
E: python-dependency-injector: package-installs-python-bytecode usr/lib/python2.7/dist-packages/dependency_injector/__init__.pyc
E: python-dependency-injector: package-installs-python-bytecode usr/lib/python2.7/dist-packages/dependency_injector/errors.pyc
E: python-dependency-injector: package-installs-python-bytecode usr/lib/python2.7/dist-packages/dependency_injector/ext/__init__.pyc
E: python-dependency-injector: package-installs-python-bytecode usr/lib/python2.7/dist-packages/dependency_injector/ext/flask.pyc
E: python-dependency-injector: python-package-missing-depends-on-python
W: python-dependency-injector: new-package-should-not-package-python2-module python-dependency-injector
Finished running lintian.
root@19debb68ceaa:/code# cd ../
root@19debb68ceaa:/# ls -la
total 84352
drwxr-xr-x   1 root root     4096 Mar 21 16:55 .
drwxr-xr-x   1 root root     4096 Mar 21 16:55 ..
-rwxr-xr-x   1 root root        0 Mar 21 16:25 .dockerenv
drwxr-xr-x   1 root root     4096 Mar 21 16:26 bin
drwxr-xr-x   2 root root     4096 Jan 30 17:37 boot
drwxr-xr-x  29 root root      928 Mar 21 16:54 code
drwxr-xr-x   5 root root      360 Mar 21 16:25 dev
drwxr-xr-x   1 root root     4096 Mar 21 16:29 etc
drwxr-xr-x   2 root root     4096 Jan 30 17:37 home
drwxr-xr-x   1 root root     4096 Mar 21 16:26 lib
drwxr-xr-x   2 root root     4096 Mar 11 00:00 lib64
drwxr-xr-x   2 root root     4096 Mar 11 00:00 media
drwxr-xr-x   2 root root     4096 Mar 11 00:00 mnt
drwxr-xr-x   2 root root     4096 Mar 11 00:00 opt
dr-xr-xr-x 127 root root        0 Mar 21 16:25 proc
-rw-r--r--   1 root root  1831908 Mar 21 16:55 python-dependency-injector-dbgsym_3.44.0-1_amd64.deb
-rw-r--r--   1 root root     3088 Mar 21 16:40 python-dependency-injector_3.44.0-1.debian.tar.xz
-rw-r--r--   1 root root      200 Mar 21 16:54 python-dependency-injector_3.44.0-1.diff.gz
-rw-r--r--   1 root root     1044 Mar 21 16:54 python-dependency-injector_3.44.0-1.dsc
-rw-r--r--   1 root root    18119 Mar 21 16:55 python-dependency-injector_3.44.0-1_amd64.build
-rw-r--r--   1 root root     5819 Mar 21 16:55 python-dependency-injector_3.44.0-1_amd64.buildinfo
-rw-r--r--   1 root root     2498 Mar 21 16:55 python-dependency-injector_3.44.0-1_amd64.changes
-rw-r--r--   1 root root   368604 Mar 21 16:55 python-dependency-injector_3.44.0-1_amd64.deb
-rw-r--r--   1 root root 84037123 Mar 21 16:49 python-dependency-injector_3.44.0.orig.tar.gz
drwx------   2 root root     4096 Mar 11 00:00 root
drwxr-xr-x   1 root root     4096 Mar 21 16:26 run
drwxr-xr-x   2 root root     4096 Mar 11 00:00 sbin
drwxr-xr-x   2 root root     4096 Mar 11 00:00 srv
dr-xr-xr-x  13 root root        0 Mar 21 16:44 sys
drwxrwxrwt   1 root root     4096 Mar 21 16:55 tmp
drwxr-xr-x   1 root root     4096 Mar 11 00:00 usr
drwxr-xr-x   1 root root     4096 Mar 11 00:00 var
root@19debb68ceaa:/# dpkg -i python-dependency-injector_3.44.0-1_amd64.deb
(Reading database ... 33257 files and directories currently installed.)
Preparing to unpack python-dependency-injector_3.44.0-1_amd64.deb ...
Unpacking python-dependency-injector (3.44.0-1) over (3.44.0-1) ...
Setting up python-dependency-injector (3.44.0-1) ...
root@19debb68ceaa:/# python
Python 2.7.16 (default, Oct 10 2019, 22:02:15)
[GCC 8.3.0] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import dependency_injector
>>> dependency_injector
<module 'dependency_injector' from '/usr/lib/python2.7/dist-packages/dependency_injector/__init__.py'>
>>> import dependency_injector.providers
>>> dependency_injector.providers
<module 'dependency_injector.providers' from '/usr/lib/python2.7/dist-packages/dependency_injector/providers.so'>

However it all was quite buggy (there are a lot of different errors and warnings if you follow the log).

Here are the changes that I've done:

diff --git a/debian/control b/debian/control
index 6f7914e1..6782a588 100755
--- a/debian/control
+++ b/debian/control
@@ -3,14 +3,8 @@ Priority: optional
 Maintainer: maxlavr <[email protected]>
 Build-Depends: debhelper (>= 9),
                dh-python,
-               cython,
                python-all,
-               python-six,
-               python-doc,
-               python-sphinx,
-               python-unittest2,
-               python-coverage,
-               python-flake8
+               python-six
 Standards-Version: 3.44.0
 Section: python
 Homepage: https://github.com/ets-labs/python-dependency-injector/tree/3.44.0
diff --git a/debian/python-dependency-injector.substvars b/debian/python-dependency-injector.substvars
old mode 100755
new mode 100644
index ffd92a1d..304fbc8f
--- a/debian/python-dependency-injector.substvars
+++ b/debian/python-dependency-injector.substvars
@@ -1,6 +1,3 @@
-python:Depends=python (<< 2.8), python (>= 2.7~), python-six (>= 1.7.0), python-six (<= 1.15.0), python:any (<< 2.8), python:any (>= 2.7.5-5~), python:any (>= 2.7~)
-python:Provides=python2.7-dependency-injector
-python:Versions=2.7
 shlibs:Depends=libc6 (>= 2.14)
 misc:Depends=
 misc:Pre-Depends=
diff --git a/debian/rules b/debian/rules
index 96f74806..e366b21b 100755
--- a/debian/rules
+++ b/debian/rules
@@ -16,7 +16,7 @@
 #export PYBUILD_NAME=dependency-injector

 %:
-       dh $@ --with python3,sphinxdoc  --buildsystem=pybuild
+       dh $@ --with python3 --buildsystem=pybuild

I think that pybuild is a right tool for that work. However, I faced it for the first time and not sure how to configure it properly. Seems like there is a bunch of different configuration options that could help to build the package for both Python2 and Python3, running tests etc. I'll leave the issue opened. If you have any updates or suggestions, you're welcome to share. I'll also add a backlog item for myself to get familiar with how pybuild works. When we have a stable debian package, I could include it in the main repo.

rmk135 avatar Mar 21 '21 17:03 rmk135

@rmk135 Thank you for the answer!

I have the same logs output while buildiing, but package is installing correctly. We done some test of our software which use python-dependency-injector. The results tells us it working properly. But I doubt a little because we have some warnings in the logs while building. The main problem in these strings:

byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext/aiohttp.py to aiohttp.pyc
  File "/usr/lib/python2.7/dist-packages/dependency_injector/ext/aiohttp.py", line 42
    async def _view(request, *args, **kwargs):
        ^
SyntaxError: invalid syntax

byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/ext/flask.py to flask.pyc
byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/resources.py to resources.pyc
  File "/usr/lib/python2.7/dist-packages/dependency_injector/resources.py", line 11
    ...
    ^
SyntaxError: invalid syntax

byte-compiling /code/debian/python-dependency-injector/usr/lib/python2.7/dist-packages/dependency_injector/wiring.py to wiring.pyc
  File "/usr/lib/python2.7/dist-packages/dependency_injector/wiring.py", line 31
    ...
    ^
SyntaxError: invalid syntax

I have some experience in creating deb packages and I know that if debhelper caught error while building process will be stopped. As you can see in the output logs, this wasn't in the case. You may be confused by a bunch of output errors that appear as a result of running lintian but it's not so important. Lintian tools checks package that have already built, search syntax error and сompares to complience with standarts. They can be fixed very fast. I don't understand source code of your project because my python skills not so high. Could you tell me how correct it is to use the package compiled with warning above?

maxlavr avatar Mar 22 '21 06:03 maxlavr

Hi @maxlavr ,

But I doubt a little because we have some warnings in the logs while building. Could you tell me how correct it is to use the package compiled with warning above?

No worries, that's ok.

Dependency Injector does not load these modules when work on Python 2. These errors come from the deb installer. I'm also curious why it doesn't fail on the error. That seems to be a pybuild "feature".

rmk135 avatar Mar 22 '21 14:03 rmk135

@rmk135 Yes, pybuild does not consider this a critical error, so it continues building the project.

I have a desire to modify this package by adding documentation to it, correct changelog file and send it to you for open use if you don't mind. First of all I need from you only your consent or lack thereof)))

I can prepare a source package with edited build instructions, send you a link for revision, and give you the opportunity to comment on them. If everything works out with this version and everything suits you, I would help you put together a package with the current version

PS. my team of developers have checked package I've built and it's work properly!

maxlavr avatar Mar 23 '21 14:03 maxlavr

First of all I need from you only your consent or lack thereof)))

Yep, you got it :)

I can prepare a source package with edited build instructions, send you a link for revision, and give you the opportunity to comment on them. If everything works out with this version and everything suits you, I would help you put together a package with the current version

Sounds good.

PS. my team of developers have checked package I've built and it's work properly!

Wonderful. Great news!

rmk135 avatar Mar 23 '21 15:03 rmk135