📜 ⬆️ ⬇️

Sending python packages to ppa without “life pain”

After the post about the TV series watcher, I’ve got a wish to add subliminal for loading subtitles. After seeing its dependencies , of which only two packages are present in the repository, and then not the appropriate versions. I realized that life is a pain and I have to create five debian / control, make five changelog'ov and create 20 tasks in jenkins.

But why spend the whole two hours on all this, if you can spend only a few days automating this process. As a result, pytoppa appeared, it:


Installation


Ubuntu


In ubuntu, the package can be delivered from ppa:
sudo add-apt-repository ppa:nvbn-rm/ppa sudo apt-get update sudo apt-get install pytoppa 

Other distributions


You need to manually install dh-make and cdbs , and then put pytoppa via pip:
 pip install pytoppa 

Using


At the root of the repository with the project you need to create .pytoppa.yml, its format is:
 section:  #   python,    dependencies: - -1 - -2 releases: - -1 - -2 

For example, for the series_list application:
 section: net dependencies: - python-requests - python-beautifulsoup - python-gevent - python-decorator - python-libtorrent - python-pyside - subliminal releases: - saucy - precise - quantal - raring 


And run:
 pytoppa ---launchpad ppa 

For example, I run:
 pytoppa 'Vladimir Iakovlev <nvbn.rm@gmail.com>' 'ppa:nvbn-rm/ppa' 

How does it work


Reading the parameters from setup.py turned out to be a bit nontrivial. The easiest way was to replace setuptools.setup and distutils.core.setup with your method, which simply saves the parameters.

And forming a changelog , for him it was necessary:
  1. get all commits in which setup.py is present;
  2. for each commit, copy the repository to a temporary folder and switch to the commit. Initially, the application ran only on commits, where setup.py changed, but often the version is imported from another file;
  3. read the version from setup.py;
  4. take changes from the commit log between different versions.

At the remaining stages, simply copying or launching commands.
')

Links


github project ;
ppa with project .

Source: https://habr.com/ru/post/204526/


All Articles