add raw and Debian python packaging (#59578)
This commit is contained in:
parent
f338157b51
commit
cc7b2bb9aa
|
@ -1,2 +1,3 @@
|
||||||
dist/js/
|
dist/js/
|
||||||
|
dist/*.gz
|
||||||
node_modules/
|
node_modules/
|
||||||
|
|
|
@ -0,0 +1,4 @@
|
||||||
|
recursive-include xstatic/pkg/godo/data *.css *.js *.map
|
||||||
|
include MANIFEST.in
|
||||||
|
include MANIFEST
|
||||||
|
include README.md
|
1
Makefile
1
Makefile
|
@ -8,6 +8,7 @@ DIST_FILES = dist/js/godo.js dist/js/godo.min.js dist/css/godo.css dist/js/godo.
|
||||||
|
|
||||||
clean:
|
clean:
|
||||||
rm -rf sdist
|
rm -rf sdist
|
||||||
|
rm -rf xstatic/pkg/godo/data
|
||||||
|
|
||||||
build:
|
build:
|
||||||
npm install
|
npm install
|
||||||
|
|
|
@ -2,7 +2,7 @@ Source: godo.js
|
||||||
Maintainer: Benjamin Dauvergne <bdauvergne@entrouvert.com>
|
Maintainer: Benjamin Dauvergne <bdauvergne@entrouvert.com>
|
||||||
Section: javascript
|
Section: javascript
|
||||||
Priority: optional
|
Priority: optional
|
||||||
Build-Depends: debhelper-compat (= 12)
|
Build-Depends: debhelper-compat (= 12), dh-python, python3-setuptools, python3-all
|
||||||
Standards-Version: 4.5.1
|
Standards-Version: 4.5.1
|
||||||
Vcs-Browser: https://git.entrouvert.org/godo.js
|
Vcs-Browser: https://git.entrouvert.org/godo.js
|
||||||
Vcs-Git: https://git.entrouvert.org/godo.js
|
Vcs-Git: https://git.entrouvert.org/godo.js
|
||||||
|
@ -15,3 +15,15 @@ Depends: ${misc:Depends}
|
||||||
Recommends: javascript-common
|
Recommends: javascript-common
|
||||||
Multi-Arch: foreign
|
Multi-Arch: foreign
|
||||||
Description: Wysiwyg HTML widget
|
Description: Wysiwyg HTML widget
|
||||||
|
|
||||||
|
Package: python3-xstatic-godo
|
||||||
|
Architecture: all
|
||||||
|
Depends: ${misc:Depends}, ${python3:Depends}, libjs-godo
|
||||||
|
Description: godo packaging for Python (Python 3 module)
|
||||||
|
godo javascript library packaged for setuptools (easy_install) / pip.
|
||||||
|
.
|
||||||
|
This package is intended to be used by **any** project that needs these files.
|
||||||
|
.
|
||||||
|
It intentionally does **not** provide any extra code except some metadata
|
||||||
|
**nor** has any extra requirements. You MAY use some minimal support code from
|
||||||
|
the XStatic base package, if you like.
|
||||||
|
|
|
@ -1 +1 @@
|
||||||
godo.* usr/share/javascript/godo/
|
xstatic/pkg/godo/data/* usr/share/javascript/godo/
|
||||||
|
|
|
@ -1,15 +1,7 @@
|
||||||
#!/usr/bin/make -f
|
#!/usr/bin/make -f
|
||||||
# -*- makefile -*-
|
# -*- makefile -*-
|
||||||
|
#
|
||||||
|
export PYBUILD_NAME=xstatic-godo
|
||||||
|
|
||||||
%:
|
%:
|
||||||
dh $@
|
dh $@ --with python3 --buildsystem=pybuild
|
||||||
|
|
||||||
#override_dh_auto_build:
|
|
||||||
# mkdir dist
|
|
||||||
# cp index.js dist/index.js
|
|
||||||
# patch -p1 <debian/es5-hook.diff
|
|
||||||
# NODE_PATH=debian/node_modules rollup -c debian/rollup.config.js
|
|
||||||
# rm -f dist/index.js
|
|
||||||
# uglifyjs.terser -o dist/psl.min.js dist/psl.js
|
|
||||||
# dh_auto_build
|
|
||||||
|
|
|
@ -0,0 +1,109 @@
|
||||||
|
#! /usr/bin/env python3
|
||||||
|
|
||||||
|
import os.path
|
||||||
|
import shutil
|
||||||
|
import subprocess
|
||||||
|
|
||||||
|
from distutils.cmd import Command
|
||||||
|
from distutils.command.build import build as _build
|
||||||
|
from distutils.command.sdist import sdist as _sdist
|
||||||
|
from setuptools import setup, find_packages
|
||||||
|
from xstatic.pkg import godo as xs
|
||||||
|
|
||||||
|
|
||||||
|
def get_version():
|
||||||
|
"""Use the VERSION, if absent generates a version with git describe, if not
|
||||||
|
tag exists, take 0.0- and add the length of the commit log.
|
||||||
|
"""
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
with open('VERSION') as v:
|
||||||
|
return v.read()
|
||||||
|
if os.path.exists('.git'):
|
||||||
|
p = subprocess.Popen(
|
||||||
|
['git', 'describe', '--dirty=.dirty', '--match=v*'],
|
||||||
|
stdout=subprocess.PIPE,
|
||||||
|
stderr=subprocess.PIPE,
|
||||||
|
)
|
||||||
|
result = p.communicate()[0]
|
||||||
|
if p.returncode == 0:
|
||||||
|
result = result.decode('ascii').strip()[1:] # strip spaces/newlines and initial v
|
||||||
|
if '-' in result: # not a tagged version
|
||||||
|
real_number, commit_count, commit_hash = result.split('-', 2)
|
||||||
|
version = '%s.post%s+%s' % (real_number, commit_count, commit_hash)
|
||||||
|
else:
|
||||||
|
version = result
|
||||||
|
return version
|
||||||
|
else:
|
||||||
|
return '0.0.post%s' % len(subprocess.check_output(['git', 'rev-list', 'HEAD']).splitlines())
|
||||||
|
return '0.0'
|
||||||
|
|
||||||
|
|
||||||
|
class compile_nodejs(Command):
|
||||||
|
description = 'compile scss files into css files'
|
||||||
|
user_options = []
|
||||||
|
|
||||||
|
def initialize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def finalize_options(self):
|
||||||
|
pass
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
if os.path.exists('dist/css'):
|
||||||
|
subprocess.check_call('npm install', shell=True)
|
||||||
|
subprocess.check_call('npm run build', shell=True)
|
||||||
|
if os.path.exists('xstatic/pkg/godo/data'):
|
||||||
|
shutil.rmtree('xstatic/pkg/godo/data')
|
||||||
|
shutil.copytree('dist', 'xstatic/pkg/godo/data/', ignore=shutil.ignore_patterns('*.gz'))
|
||||||
|
|
||||||
|
|
||||||
|
class build(_build):
|
||||||
|
sub_commands = [('compile_nodejs', None)] + _build.sub_commands
|
||||||
|
|
||||||
|
|
||||||
|
class sdist(_sdist):
|
||||||
|
sub_commands = [('compile_nodejs', None)] + _sdist.sub_commands
|
||||||
|
|
||||||
|
def run(self):
|
||||||
|
print("creating VERSION file")
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
os.remove('VERSION')
|
||||||
|
version = get_version()
|
||||||
|
version_file = open('VERSION', 'w')
|
||||||
|
version_file.write(version)
|
||||||
|
version_file.close()
|
||||||
|
_sdist.run(self)
|
||||||
|
print("removing VERSION file")
|
||||||
|
if os.path.exists('VERSION'):
|
||||||
|
os.remove('VERSION')
|
||||||
|
|
||||||
|
|
||||||
|
setup(
|
||||||
|
name=xs.PACKAGE_NAME,
|
||||||
|
version=get_version(),
|
||||||
|
description=xs.DESCRIPTION,
|
||||||
|
classifiers=xs.CLASSIFIERS,
|
||||||
|
keywords=xs.KEYWORDS,
|
||||||
|
maintainer=xs.MAINTAINER,
|
||||||
|
maintainer_email=xs.MAINTAINER_EMAIL,
|
||||||
|
license=xs.LICENSE,
|
||||||
|
url=xs.HOMEPAGE,
|
||||||
|
platforms=xs.PLATFORMS,
|
||||||
|
packages=find_packages(),
|
||||||
|
namespace_packages=[
|
||||||
|
'xstatic',
|
||||||
|
'xstatic.pkg',
|
||||||
|
],
|
||||||
|
include_package_data=True,
|
||||||
|
package_data={
|
||||||
|
'xstatic.pkg.godo': ['data/*'],
|
||||||
|
},
|
||||||
|
zip_safe=False,
|
||||||
|
install_requires=[], # nothing! :)
|
||||||
|
# if you like, you MAY use the 'XStatic' package.
|
||||||
|
cmdclass={
|
||||||
|
'build': build,
|
||||||
|
'sdist': sdist,
|
||||||
|
'compile_nodejs': compile_nodejs,
|
||||||
|
},
|
||||||
|
)
|
|
@ -0,0 +1 @@
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
|
@ -0,0 +1 @@
|
||||||
|
__import__('pkg_resources').declare_namespace(__name__)
|
|
@ -0,0 +1,40 @@
|
||||||
|
"""
|
||||||
|
XStatic resource package
|
||||||
|
|
||||||
|
See package 'XStatic' for documentation and basic tools.
|
||||||
|
"""
|
||||||
|
|
||||||
|
import os
|
||||||
|
|
||||||
|
DISPLAY_NAME = 'godo' # official name, upper/lowercase allowed, no spaces
|
||||||
|
PACKAGE_NAME = 'XStatic-%s' % DISPLAY_NAME # name used for PyPi
|
||||||
|
|
||||||
|
NAME = __name__.split('.')[-1] # package name (e.g. 'foo' or 'foo_bar')
|
||||||
|
# please use a all-lowercase valid python
|
||||||
|
# package name
|
||||||
|
|
||||||
|
VERSION = '0.2' # version of the packaged files, please use the upstream
|
||||||
|
# version number
|
||||||
|
BUILD = '1' # our package build number, so we can release new builds
|
||||||
|
# with fixes for xstatic stuff.
|
||||||
|
PACKAGE_VERSION = VERSION + '.' + BUILD # version used for PyPi
|
||||||
|
|
||||||
|
DESCRIPTION = "%s %s (XStatic packaging standard)" % (DISPLAY_NAME, VERSION)
|
||||||
|
|
||||||
|
PLATFORMS = 'any'
|
||||||
|
CLASSIFIERS = []
|
||||||
|
KEYWORDS = '%s xstatic' % NAME
|
||||||
|
|
||||||
|
# XStatic-* package maintainer:
|
||||||
|
MAINTAINER = 'Benjamin Dauvergne'
|
||||||
|
MAINTAINER_EMAIL = 'bdauvergne@entrouvert.com'
|
||||||
|
|
||||||
|
# this refers to the project homepage of the stuff we packaged:
|
||||||
|
HOMEPAGE = 'http://dev.entrouvert.org/project/godo/'
|
||||||
|
|
||||||
|
# this refers to all files:
|
||||||
|
LICENSE = '(same as %s)' % DISPLAY_NAME
|
||||||
|
|
||||||
|
BASE_DIR = os.path.join(os.path.dirname(__file__), 'data')
|
||||||
|
|
||||||
|
LOCATIONS = {}
|
Loading…
Reference in New Issue