Giter Club home page Giter Club logo

make-deb's Introduction

make-deb: Helper Tool for getting your python code into debian packages

Make-deb is a simple tool that generates Debian configuration based on your setuptools configuration and git history. When run, it will create a Debian directory at the root of your python project with the necessary files to build your package into a Debian package using dh-virtualenv

$ cd /my/python/repository
$ make-deb

'debian' directory successfully placed at the root of your repository

If setuptools does not have complete information, make-deb will ask for additional information (for example, maintainer email). After initialization, a directory named "debian" will be reated at the root of your repo. Assuming you have dh-virtualenv installed, you should be able to simply create a .deb from your python project by running the following command at the root of your project.

$ dpkg-buildpackage -us -uc

Installation

To install make-deb:

$ pip install make-deb

Documentation

Generating your Debian configuration can be run from any operating system. However, in order to build a debian package, you must be on a Debian-based operating system and have dh-virtualenv installed. In the future, we plan to support Vagrant integration to build packages from any platform.

make-deb's People

Contributors

emfree avatar joaorafaelm avatar spang avatar systemizer avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  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  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

make-deb's Issues

Support for files placed outside of the python source

dh-virtualenv says that the data_files directive inside setup.py is not the correct place to specify files that will reside outside of the python source root (e.g. /etc/foo/config.ini, /etc/systemd/custm.service), and that you should "[use] Debian's install files to move them into the correct location".

Is it possible to configure the install directive when the debian directory is generated using make-deb?

OSError: [Errno 2] No such file or directory

I am on a fresh box on debian jessie (via docker). I have installed dh-virtualenv via their ppa and have installed make-deb in python2.7. Once in my application directory and running make-deb I get the error below. Based on another issue I tried installing debhelper and there was no change.

$ make-deb
  File "/usr/local/bin/make-deb", line 21, in <module>
    sys.exit(main())
  File "/usr/local/bin/make-deb", line 11, in main
    debconf = DebianConfiguration(os.getcwd())
  File "/usr/local/lib/python2.7/dist-packages/make_deb/__init__.py", line 39, in __init__
    self.context.update(self._context_from_git())
  File "/usr/local/lib/python2.7/dist-packages/make_deb/__init__.py", line 45, in _context_from_git
    stdout=subprocess.PIPE).communicate()
  File "/usr/lib/python2.7/subprocess.py", line 710, in __init__
    errread, errwrite)
  File "/usr/lib/python2.7/subprocess.py", line 1335, in _execute_child
    raise child_exception
OSError: [Errno 2] No such file or directory

here is my setup.py file

from setuptools import setup

setup(
    zip_safe=False,
    maintainer="Shawn McElroy",
    maintainer_email="[email protected]",
    author="Shawn McElroy",
    author_email="[email protected]",
    description="skift website",
    license="closed",
    keywords="skiftio",
    url="http://skift.io",
    name="skiftio",
    version="0.1.0",
    install_requires=[
        "alembic==0.7.7",
        "blinker==1.4",
        "Flask==0.10.1",
        "Flask-Bcrypt==0.6.2",
        "Flask-Cache==0.13.1",
        "Flask-Login==0.2.11",
        "Flask-Migrate==1.3.1",
        "Flask-Script==2.0.5",
        "Flask-SQLAlchemy==2.0",
        "Flask-WTF==0.11",
        "gunicorn==19.3.0",
        "itsdangerous==0.24",
        "Jinja2==2.7.3",
        "Mako==1.0.1",
        "MarkupSafe==0.23",
        "python-bcrypt==0.3.1",
        "SQLAlchemy==0.9.8",
        "Werkzeug==0.10.4",
        "wheel==0.24.0",
        "WTForms==2.0.2",
    ],
)

Example/sample?

I have been unable to successfully build a deb using dpkg-buildpackage | db-virtualenv | make-deb.

It could be a bad setup.py or misconfigured python3 venv ( an issue with debian jessie) or something else...
Since this has never worked for me I would like to start troubleshooting with a known good build.

Is there a known working Python3 project that you use for testing? Can you publish it?

Thanks

Bill

Adding debian dependencies to the control file

I spend some time into digging into the tool but cannot make out how to add Debian dependencies to debian/control. Is there a canonical way of preserving that or do I have to hack that into place?

error with setup.py

when i run make-deb without setup.py on current dir.
I got this error:
python: can't open file '/root/dashboard-vtg/setup.py': [Errno 2] No such file or directory
Traceback (most recent call last):
File "/usr/local/bin/make-deb", line 16, in
main()
File "/usr/local/bin/make-deb", line 11, in main
debconf.render()
File "/usr/local/lib/python2.7/dist-packages/make_deb/init.py", line 89, in render
trigger_filename = "%s.triggers" % self.context['name']
KeyError: 'name'

Update changelog

It would be great if make-deb could bump debian/changelog from the latest git commit, instead of only on first-run.

debian package name must be lower-case

Hi there,

this tool looks fine. But, many python packages name could be with upper case letters. So, if you create control, and changelog files, you must lower case all letters from package name.

Is this project still functional?

I'm desperately looking for a way to deploy my Python server. I stumbled on this nice project that seems to need some love to work. My install from pip doesn't create a make-deb command in path, and fiddling with stuff from pull requests yields errors. Very sad ๐Ÿ˜ข

SyntaxError: invalid syntax

I get the following error trying to use make-deb on the source code from kitty, cloned from
here.

 File "/home/USER/Downloads/kitty/setup.py", line 63
    action: str = 'build'
          ^
SyntaxError: invalid syntax

This is the part of the code from the kitty repo causing trouble:

class Options(argparse.Namespace):
    action: str = 'build'
    debug: bool = False
    verbose: int = 0
    sanitize: bool = False
    prefix: str = './linux-package'
    incremental: bool = True
    profile: bool = False
    libdir_name: str = 'lib'
    extra_logging: List[str] = []
    extra_include_dirs: List[str] = []
    link_time_optimization: bool = 'KITTY_NO_LTO' not in os.environ
    update_check_interval: float = 24.0
    shell_integration: str = 'enabled'
    egl_library: Optional[str] = os.getenv('KITTY_EGL_LIBRARY')
    startup_notification_library: Optional[str] = os.getenv('KITTY_STARTUP_NOTIFICATION_LIBRARY')
    canberra_library: Optional[str] = os.getenv('KITTY_CANBERRA_LIBRARY')


Virtualenv invocation incompatible with virtualenv 20.0

Running dpkg-buildpackage -v -us -uc on a make-deb-generated directory on a system with virtualenv 20.0.20, results in the following fatal error message.

virtualenv: error: unrecognized arguments: --no-site-packages
Traceback (most recent call last):
[...]
/opt/venvs/epidose']' returned non-zero exit status 2
make: *** [debian/rules:4: binary] Error 1
dpkg-buildpackage: error: fakeroot debian/rules binary subprocess returned exit status 2

A workaround to avoid this problem is to amend the rules file as follows:

printf '\n\noverride_dh_virtualenv:\n\tdh_virtualenv --use-system-packages\n' >>debian/rules

error regarding python2 / 3

Can make-deb be used with python3 ?

I am on ubuntu 15.10 and have dh-virtualenv 0.7.2 (the apt-get version).
After install I get following error:
usr@xps:~/pq$ pip3 install make-deb
Collecting make-deb
Using cached make-deb-0.0.4.tar.gz
Requirement already satisfied (use --upgrade to upgrade): Jinja2 in /home/usr/.venvs/pq3/lib/python3.4/site-packages (from make-deb)
Requirement already satisfied (use --upgrade to upgrade): MarkupSafe in /home/usr/.venvs/pq3/lib/python3.4/site-packages (from Jinja2->make-deb)
Building wheels for collected packages: make-deb
Running setup.py bdist_wheel for make-deb ... done
Stored in directory: /home/usr/.cache/pip/wheels/2f/01/5f/ea57068e5f453fb5fd2326faf937c35c79c0cf998bd0eeaf09
Successfully built make-deb
Installing collected packages: make-deb
Successfully installed make-deb-0.0.4

(pq3) usr@xps:~/pq$ make-deb
File "/home/usr/.venvs/pq3/bin/make-deb", line 14
print e
^
SyntaxError: Missing parentheses in call to 'print'

KeyError when trying to run

I'm on OSX

$ make-deb
error in sample setup command: package_data must be a dictionary mapping package names to lists of wildcard patterns
Traceback (most recent call last):
  File "/Users/daenyth/Curata/.env/cmp/bin/make-deb", line 21, in <module>
    sys.exit(main())
  File "/Users/daenyth/Curata/.env/cmp/bin/make-deb", line 12, in main
    debconf.render()
  File "/Users/daenyth/Curata/.env/cmp/lib/python2.7/site-packages/make_deb/__init__.py", line 108, in render
    trigger_filename = "%s.triggers" % self.context['name']
KeyError: 'name'

I'm also not sure why the package_data warning is there: I have package_data={'mypkg': ['foo/*', 'bar/*']} (more or less)

Caching?

Your blog post says you cache your build dependencies for faster builds. I'm using up-to-date versions of dh_virtualenv and pip, but a simple project with requests as the only dependency still takes 30s to build, because pip needs to re-download it on every build.

How did you configure make-deb/dh_virtualenv to cache your dependencies?

Unable to build a deb package.

I was able to successfully run make-deb to create a debian folder, but when I try to run dpkg-buildpackage -us -uc, I get the following error:

dpkg-buildpackage: host architecture amd64
dpkg-buildpackage: warning: debian/rules is not executable; fixing that
 dpkg-source --before-build pgcli
dpkg-checkbuilddeps: Unmet build dependencies: debhelper (>= 9) dh-virtualenv (>= 0.8)
dpkg-buildpackage: warning: build dependencies/conflicts unsatisfied; aborting
dpkg-buildpackage: warning: (Use -d flag to override.)

I do have dh-virtualenv installed. Here's the pip freeze output:

click==4.0
configobj==5.0.6
dh-virtualenv==0.8.99
Jinja2==2.7.3
make-deb==0.0.3
MarkupSafe==0.23
pgcli==0.18.0
prompt-toolkit==0.42
psycopg2==2.6.1
Pygments==2.0.2
six==1.9.0
sqlparse==0.1.14
wcwidth==0.1.4
wheel==0.24.0

Can you please help?

Changelog failure

Running dpkg-buildpackage -v -us -uc on a make-deb generated directory, results in the following fatal error message.

dpkg-genchanges: warning: 'since' option specifies non-existing version ''
dpkg-genchanges: warning: use newest entry that is earlier than the one specified
dpkg-genchanges: error:  is not a valid version
dpkg-buildpackage: error: dpkg-genchanges subprocess returned exit status 255

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.