Home
About
Blog
Products
Forum
Support
Contact
Sunbelt Computer Software
PL/B Language Development and Support
Home
About
Blog
Products
Forum
Support
Contact
pdf2htmlEX/build_for_ppa.py at master · Nelida58/pdf2htmlEX · GitHub
Skip to content
Navigation Menu
Sign in
Products
Platform
GitHub
Repository hosting, code review, and collaboration
Copilot
AI coding agent for tasks, projects and automated work
Build & Ship
Actions
CI/CD and automation
Code Quality
Quality analysis, fixes, and enforcement
Codespaces
Cloud development environments
Secure
Code Security
Vulnerability detection and remediation
Secret Protection
Secret scanning and leak prevention
All Features
Developers
Learn
Documentation
Training
Certifications
Build
Build with Copilot
Customize Copilot
Integrations
Explore
Trending repos
GitHub Sponsors
Events
Changelog
Changelog
Your source for the latest features, improvements, and fixes across GitHub products, all in one place.
Businesses
By Stage
Enterprises
Team
Startups
Nonprofits
By Industry
Healthcare
Financial services
Manufacturing
Government
See all industries
Evaluate GitHub
Why GitHub
Customer Stories
Business insights
Trust Center
Add-ons
GitHub Advanced Security
Enterprise-grade code security
Copilot for business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Resources
Learn & Connect
Documentation
Resource center
Blog
Events & webinars
Community Forum
Customer Stories
Integrations
Support
Customer support
Training
GitHub Status
Company
About
Partners
Changelog
GitHub Universe
GitHub Universe
The event for developers, by developers — talks, workshops, and what’s next for GitHub.
Pricing
Search
/
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Nelida58
pdf2htmlEX
Repository navigation
Code
Pull requests
Actions
Projects
Security and quality
Insights
More
items
Files
Expand file tree
master
Breadcrumbs
pdf2htmlEX
/
build_for_ppa.py
Copy path
Blame
More file actions
Blame
More file actions
Latest commit
History
History
History
executable file
·
137 lines (109 loc) · 3.59 KB
master
Breadcrumbs
pdf2htmlEX
/
build_for_ppa.py
Copy path
Top
File metadata and controls
Code
Blame
executable file
·
137 lines (109 loc) · 3.59 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
#!/usr/bin/env python
"""
Dirty script for building package for PPA
by WangLu
2011.01.13
modified for pdf2htmlEX
2012.08.28
modified for general git repo
2013.05.30
"""
import
os
import
sys
import
re
import
time
package
=
'pdf2htmlex'
ppa_name
=
'ppa:coolwanglu/pdf2htmlex'
supported_distributions
=
(
'precise'
,
'trusty'
)
dist_pattern
=
re
.
compile
(
'|'
.
join
([
'
\\
) '
+
i
for
i
in
supported_distributions
]))
archive_cmd
=
'(rm CMakeCache.txt || true) && cmake . && make dist'
archive_suffix
=
'.tar.bz2'
print
'Generating version...'
try
:
version
=
re
.
findall
(
r'set\(PDF2HTMLEX_VERSION\s*"([^"]*)"\)'
,
open
(
'CMakeLists.txt'
).
read
())[
0
]
except
:
print
'Cannot get package name and version number'
sys
.
exit
(
-
1
)
try
:
rev
=
open
(
'.git/refs/heads/master'
).
read
()[:
5
]
except
:
print
'Cannot get revision number'
sys
.
exit
(
-
1
)
projectdir
=
os
.
getcwd
()
today_timestr
=
time
.
strftime
(
'%Y%m%d%H%M'
)
deb_version
=
version
+
'-1~git'
+
today_timestr
+
'r'
+
rev
full_deb_version
=
deb_version
+
'-0ubuntu1'
#check if we need to update debian/changelog
with
open
(
'debian/changelog'
)
as
f
:
if
re
.
findall
(
r'\(([^)]+)\)'
,
f
.
readline
())[
0
]
==
full_deb_version
:
print
print
'No need to update debian/changelog, skipping'
else
:
print
print
'Writing debian/changelog'
if
os
.
system
(
'dch -v "%s"'
%
(
full_deb_version
,))
!=
0
:
print
'Failed when updating debian/changelog'
sys
.
exit
(
-
1
)
# changelog may have been updated, reopen it
with
open
(
'debian/changelog'
)
as
f
:
#check dist mark of changelog
changelog
=
f
.
read
()
m
=
dist_pattern
.
search
(
changelog
)
if
m
is
None
or
m
.
pos
>=
changelog
.
find
(
'
\n
'
):
print
'Cannot locate the dist name in the first line of changelog'
sys
.
exit
(
-
1
)
print
print
'Preparing build ...'
# handling files
if
os
.
system
(
archive_cmd
)
!=
0
:
print
'Failed in creating tarball'
sys
.
exit
(
-
1
)
orig_tar_filename
=
package
+
'-'
+
version
+
archive_suffix
if
os
.
system
(
'test -e %s && cp %s ../build-area/'
%
(
orig_tar_filename
,
orig_tar_filename
))
!=
0
:
print
'Cannot copy tarball file to build area'
sys
.
exit
(
-
1
)
deb_orig_tar_filename
=
package
+
'_'
+
deb_version
+
'.orig'
+
archive_suffix
try
:
os
.
chdir
(
'../build-area'
)
except
:
print
'Cannot find ../build-area'
sys
.
exit
(
-
1
)
# remove old dir
os
.
system
(
'rm -rf %s'
%
(
package
+
'-'
+
version
,))
if
os
.
system
(
'mv %s %s && tar -xvf %s'
%
(
orig_tar_filename
,
deb_orig_tar_filename
,
deb_orig_tar_filename
))
!=
0
:
print
'Cannot extract tarball'
sys
.
exit
(
-
1
)
try
:
os
.
chdir
(
package
+
'-'
+
version
)
except
:
print
'Cannot enter project dir'
sys
.
exit
(
-
1
)
os
.
system
(
'cp -r %s/debian .'
%
(
projectdir
,))
for
cur_dist
in
supported_distributions
:
print
print
'Building for '
+
cur_dist
+
' ...'
# substitute distribution name
with
open
(
'debian/changelog'
,
'w'
)
as
f
:
f
.
write
(
dist_pattern
.
sub
(
'~%s1) %s'
%
(
cur_dist
,
cur_dist
),
changelog
,
1
))
# building
if
os
.
system
(
'debuild -S -sa'
)
!=
0
:
print
'Failed in debuild'
sys
.
exit
(
-
1
)
"""
print
sys.stdout.write('Everything seems to be good so far, upload?(y/n)')
sys.stdout.flush()
ans = raw_input().lower()
while ans not in ['y', 'n']:
sys.stdout.write('I don
\'
t understand, enter
\'
y
\'
or
\'
n
\'
:')
ans = raw_input().lower()
if ans == 'n':
print 'Skipped.'
sys.exit(0)
"""
print
'Uploading'
if
os
.
system
(
'dput %s ../%s'
%
(
ppa_name
,
package
+
'_'
+
full_deb_version
+
'~'
+
cur_dist
+
'1_source.changes'
))
!=
0
:
print
'Failed in uploading by dput'
sys
.
exit
(
-
1
)
print
'Build area not cleaned.'
print
'All done. Cool!'
You can’t perform that action at this time.